4
I'm finding a bunch of files with find . -exec grep -l mypattern {} \;
What's the simplest, most elegant way to run a certain command separately on each of the resulting list of files?
4
I'm finding a bunch of files with find . -exec grep -l mypattern {} \;
What's the simplest, most elegant way to run a certain command separately on each of the resulting list of files?
9
To begin with, use:
grep -Rl mypattern .
directly instead of the find
construct.
What is the certain command? Probably the best and most fail-safe way would be
grep -ZRl mypattern . | xargs -0 mycommand
Exactly what you want to do is up to xargs
from here.