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

Steve Willer http://www.willer.ca/

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

One-line shell script for find and replace

An equivalent of the other find-replace, except it's a one-liner that generates no temp files, and is more flexible:

perl -pi -e 's/find/replace/g' *.txt


Or, to change matching files in a hierarchy:

find . -name '*.txt' |xargs perl -pi -e 's/find/replace/g'
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS