Posted by: Anonymous Coward
on July 11, 2006 10:50 PM
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
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.
Re:How about xargs?
Posted by: Anonymous Coward on July 11, 2006 10:50 PMWell, 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.
#