I know the grep
command and I am learning about the functionalities of xargs
, so I read through this page which gives some examples on how to use the xargs
command.
I am confused by the last example, example 10. It says "The xargs command executes the grep command to find all the files (among the files provided by find command) that contained a string ‘stdlib.h’"
$ find . -name '*.c' | xargs grep 'stdlib.h'
./tgsthreads.c:#include
./valgrind.c:#include
./direntry.c:#include
./xvirus.c:#include
./temp.c:#include
...
...
...
However, what is the difference to simply using
$ find . -name '*.c' | grep 'stdlib.h'
?
Obviously, I am still struggling with what exactly xargs is doing, so any help is appreciated!