find & replace text in file(s)

  • August 25, 2012
  • Perl

find and replace text in a particular file

[code]perl -pi -e ‘s!/replace/this/!/with/this/!g’ file.php[/code]

find and replace text in all files

[code]perl -pi -e ‘s!/replace/this/!/with/this/!g’ *[/code]

backup each file just in case you ruin it!

[code]perl -pi.bak -e ‘s!/replace/this/!/with/this/!g’ *[/code]




No Comments


No comments yet.



Leave a Reply

Your email address will not be published. Required fields are marked *