Moshe Moshe - 1 year ago 70
Linux Question

Piping result of command as an argument

I want to get the result of

rpm -qa | grep something
and then run the result I got
rpm -ql result-i-got
, and all in one line.

I have found this to work:

rpm -ql $(rpm -qa | grep something)

I wonder, is there any better or even different way of piping this result to get the same result of what I wrote above?

Answer Source

xargs are made for that:

rpm -qa | grep something | xargs rpm -ql
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download