find . -name "*.txt" -exec perl -pe 's/XYZ/ABC/g' -i {} \;
Notes
- You need to have perl installed on your system
- with -exec you can execute a command on the found files
- -i option of perl is used to update files
- -p option of perl command assumes a loop around the code just like the -n switch. Only difference is that it prints the lines.
- XYZ is a regular expression to be searched and ABC is the replacement text.
No comments:
Post a Comment