Thursday, August 28, 2008

xargs

xargs command take the output from one command and send certain number of lines to another command.
Lets look at the following example
ls > list.txt
cat list.txt | xargs -i file {}


file command use to get the type of the file.
xargs -i command takes one whole line as a one input and ingore the space infront of the lines.

xargs -t command writes each generated command to the standard error.

xargs -l command execute for each nonempty line. Line is considered to be end with the first new line character.

No comments: