- About Us
Well, true enough, and an interesting feature. But xargs is more flexible. For example, if I want to grep files whose names end in ".txt" that occur in directories named "doc" found anywhere in a file system tree, then
<tt>find . -type f -name '*.txt' | grep '/doc/' | xargs grep pattern</tt>
is my friend. Note that the "." argument to find causes the pathnames to be prefixed with "./", which ensures that any "doc" directory at the top level of the tree is found.
Return to CLI Magic: Searching with find