Friday, May 29, 2015

Search and Replace String across multiple files in Linux

Print this post
  perl -pi -e 's/old_string/new_string/g' file_pattern

  perl -pi -e 's/temp/tmp/g' *.html
  /happy/
To correctly replace it, you would have to escape the forward slashes with the escape character (the backslash) so that the forward slashes aren't interpreted as commands. Your replacement string would need to be:
  \/happy\/

No comments: