Skip to content

Search and replace string in file using Perl

Search and replace string in file using Perl

Answer:

Besides using sed, Perl can also replace file in place with one-liner.

# perl -0777 -i -pe 's/abc/def/g' test.txt

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
  1. How to replace a string in a file using Perl
  2. Replace a string using regular expressions in Perl
  3. Insert search string back to the result in sed
  4. Speedup sed search and replace
  5. Trim a string using Perl

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*