Command line Global Search and Replace

By Hawkee on Apr 13, 2007

This is a very handy command line use of perl. You basically execute the s// function of perl on a handful of files to do a global search and replace. Just run this from the command line and indicate what files you'd like to run this against. The .bak indicates the extension for original files backed up.

perl -pi.bak -e "s/search/replace/g" *

Comments

Sign in to comment.
xplo   -  Nov 17, 2009

what a gangstar!! \/\/
... not.!

 Respond  
bps19882006   -  Oct 17, 2007

very nice hawkee ;) kudos

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.