Reputation: 41
I can do the find and replace a string in multiple files with the below command.
find . -name '*.py' | xargs sed -i 's/foo/faa/g'
Can we do the same by using Perl
?
Upvotes: 0
Views: 112
Reputation: 17711
Try this command...:
find . -name '*.py' | xargs perl -p -i -e 's/foo/faa/g'
N.B.: If you want to make a backup copy of your files before changing them, provide -i
flag with an extension... I.E.: -i.bak
...
Upvotes: 1