Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.
~]$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..?

share|improve this question

1 Answer 1

up vote 3 down vote accepted
$ sudo yum install $(yum list packages | awk '{ print $2 }')
share|improve this answer
    
It works with $1. Thanks! –  Achmed Durangi Sep 5 '12 at 13:18
1  
Just an example since you want to get the second column. –  quanta Sep 5 '12 at 13:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.