Skip to main content

How can I pass the results of a command to another?

26 Feb 2013 - linux

The xargs program passes the outputs of one command as arguments to another one.

The following is an example of processing the results of find using xargs:

find . -name <pattern> -print0 | xargs -0 -I {} <command with {} as an argument>

find -print0 and xargs -0 make find and xargs handle files with unusual characters in their names properly.

References