Re: xargs with max each line / argument

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Thanks for the help everyone. I used awk as the gem.list file may
contain version number in brackets - "rake (1.2)". I should have
mentioned this before. I used 'awk $1' to get first column from each
row. I liked all inputs, but I think I will try mark's awk solution
here. Thanks again..




On Tue, May 17, 2011 at 8:30 AM,  <m.roth@xxxxxxxxx> wrote:
> Andy Holt wrote:
>>> [mailto:centos-bounces@xxxxxxxxxx] On Behalf Of neubyr
>>>
>>> How do I pass xargs input one line at a time to subsequent command?
>>> For example I want to install rubygems by reading a text file as shown
>>> below, however the arguments are getting passed all at once to the
>>> 'gem install' command. I hace tried -L (max-lines) and -n (max args)
>>> options, but it didn't work. What's missing here?? Any help?
>>>
>>> $ cat gem.list.1
>>> mkrf
>>> rake
>>> xmlparser
>>>
>>> $ awk '{ print $0 }' gem.list.1 | xargs -L 1 -0 -I name sudo
>>> gem install name
>>> ERROR:  could not find gem mkrf
>>> rake
>>> xmlparser
>>>  locally or in a repository
> <snip>
> Screw xargs. Read an awk tutorial, maybe. Learn your tools.
>
> awk '{name = $1; cmd = "sudo gem install " name; system( cmd);}' gem.list.1.
>
>       mark "yes, I do do awk..."
>
> _______________________________________________
> CentOS mailing list
> CentOS@xxxxxxxxxx
> http://lists.centos.org/mailman/listinfo/centos
>
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos



[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux