Separate filenames using the null character:
------------------------------ --------------------
find . -name "*.foo" | xargs grep bar
in practice does the same as
grep bar `find . -name "*.foo"`
but will work even if there are so many files to search that they will not all fit on a single command line. It searches in all files in the current directory and its subdirectories which end in .foo f
------------------------------
find . -name "*.foo" | xargs grep bar
in practice does the same as
grep bar `find . -name "*.foo"`
but will work even if there are so many files to search that they will not all fit on a single command line. It searches in all files in the current directory and its subdirectories which end in .foo f
or occurrences of the string bar.
find . -name "*.foo" -print0 | xargs -0 grep bar
does the same thing, but uses GNU specific extensions to find and xargs to separate filenames using the null character; this will work even if there are whitespace characters, including newlines,
find . -name "*.foo" -print0 | xargs -0 grep bar
does the same thing, but uses GNU specific extensions to find and xargs to separate filenames using the null character; this will work even if there are whitespace characters, including newlines,
No comments:
Post a Comment