Skip to content

sed: replace in place

sed: replace in place

Answer:

Newer version of sed allow you replace a file in place, no more redirection is needed.

# sed -i 's/abc/def/g' test.txt

The above command will replace all "abc" to "def" in the file 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. Search and replace string in file using Perl
  3. Replace multiple strings using sed
  4. How to determine the type of a file in Linux
  5. Replace text in vi

One Trackback/Pingback

  1. Search and replace string in file using Perl | Linux Ask! on Friday, February 12, 2010 at 3:30 pm

    [...] using sed, Perl can also replace file in place with [...]

Post a Comment

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