Find and replace text within a file using sed command

The procedure to change the text in files under Linux/Unix using sed:

  1. Use Stream Editor (sed) as follows:
  2. sed -i 's/old-text/new-text/g' input.txt
  3. The s is the substitute command of sed to find and replace
  4. It tells sed to find all occurrences of ‘old-text’ and replace with ‘new-text’ in a file named input.txt
  5. Verify that file has been updated:
  6. more input.txt