Bash: sed for String Substitution

using sed to replace strings in text files without a text editor

sed 's/sedtest/seedtest/' sedtest.txt > seedtest.txt && mv seedtest.txt sedtest.txt
  • s = substitute
  • find = sedtest
  • replace with = seedtest
  • sed won't alter the source file, but a destination file can be specified
  • if one wants to effectively update the SOURCE file, simply append the command with 'mv'

see also: https://www.computerhope.com/unix/used.htm

Tags