I\'m pretty much confused on this. Need some clarifications.
Example 1 :
pgrep string | xargs ps
Example 2 :>
A good example of what xargs does is to try getting sorted checksums for every file in a directory using find.
find . | cksum | sort
returns just one checksum, and it's not clear what it's the checksum for. Not what we want. The pipe sends the stdout from find into stdin for cksum. What cksum really wants is a list of command line args, e.g.
cksum file001.blah file002.blah file003.blah
will report three lines, one per file, with the desired checksums. Xargs does the magic trick - converting stdout of the previous program to a temporary and hidden command line to feed to the next. The command line that works is:
find . | xargs cksum | sort
Note no pipe between xargs and cksum.