pipe and xargs
tags: learning linux diff-between
content
- pipe
|directs the output of a command to the input of another command- output is treated as a whole, like
cmd1 > filethencmd2 < file
- output is treated as a whole, like
xargsuses the output of the previous command as input arguments to another command- output is separated by
,\nor\null, then input to another command - like
cmd1 > file,for line in file: cmd2 line
- output is separated by
compare:
find . -name "*.txt" | wc -lfind . -name "*.txt" | xargs wc -l