This blog is to share my experience about what I am learning, troubleshooting in my day-to-day life while working on Linux Servers.
Tuesday, March 3, 2009
Find and Replace several files
If you need to change the same thing in hundreds of files then following script is for you. It will create the backup of every file with .bak extension.
This will work effectively for 'find and replace' in folders/sub-folders:
ReplyDeleteIf all the files are with .xml extension:
find . -name "*.xml" | while read a; do perl -pi.bak -e 's/source/target/g' $a; done