Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Dave Bryand

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Shell script to recursively find files with the same name and replace text within each of them

This shell script recursively finds files with the same name and replaces text within each of them

FILE="filename.txt"
FIND="old text"
REPLACE="new text"
find . -name $FILE -print0 | xargs -0p perl -pi -w -e "s/$FIND/$REPLACE/g;"


Remove the p flag if confirmation is not necessary.
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS