Thursday, 5 September 2013

How to pass results of results to another command in shell?

How to pass results of results to another command in shell?

Using the following combination of grep, ls and awk I get a list of pid
that I need to kill:
grep -hP '^\d+$' `ls -lad /dir/*/pid | grep -P '/dir/\d+/pid' | awk '{
print $9 }'`
13234
18972
24322
How can I now add kill -9 command to this command combination to kill
those processes?
I already using **** characters to passawkresults togrepcommand, so I
assume I cannot use it again to pass it tokill`, correct?

No comments:

Post a Comment