1
~]$packageManager list packages 

gives back

wordA1 wordB1 wordC1
wordA2 wordB2 wordC2
wordA3 wordB3 wordC3

I then want to run a second command on all B-column words, e.g.

~]$packageManager install packages wordB1 wordB2 wordB3

How can I achieve this elegantly, maybe as one liner with xargs..?

1 Answer 1

2
$ sudo yum install $(yum list packages | awk '{ print $2 }')
1
  • 1
    Just an example since you want to get the second column.
    – quanta
    Sep 5, 2012 at 13:21

You must log in to answer this question.