Normally to search and replace a string in a selection of files, I would find with:
grep -rl 'pattern' .
This works fine unless you have a LOT of matches.
Anyway, I was looking around and found a suggestion of using find
instead:
find /root/path -type f -exec grep -l 'FIND' {} +
This works fine, but when I try and pass it into Perl to do the replacement, I get the error still:
perl -p -i -e 's|FIND|REPLACE|g' `find /root/path -type f -exec grep -l 'FIND' {} +`
-bash: /usr/local/bin/perl: Argument list too long
Is there any way around this?