Moshe Moshe - 6 months ago 12
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?
Thanks.

Answer

xargs are made for that:

rpm -qa | grep something | xargs rpm -ql