Find and replace text within a file using sed command

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #20
    VPS Offers
    Keymaster

    Find and replace text within a file using sed command on Linux:

    # sed -i 's/old-text/new-text/g' input.txt

    Replace all occurances of ‘old-text’ with ‘new-text’ in the file input.txt, without creating a backup of the file on FreeBSD:

    # sed -i '' -e 's/old-text/new-text/g' input.txt

    • This topic was modified 3 weeks, 2 days ago by VPS Offers.
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.