Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

sed is short for stream editor. It reads in a file (one line at a time), modifies the contents per your parameters, and then outputs.

Basics

A more simple description, it allows you to modify the contents of a file without you actually having to open it.

...

Code Block
languagebash
sed -i 's,original/path,new/path,' notes.txt # do not need to escape '/' since we are using ',' as a separator

Insert Multiple Lines from File with Match

..

Code Block
languagebash
sed '/cdef/r muliple-lines.txt' notes.txt

..

References

Simple introduction - http://www.grymoire.com/Unix/Sed.html
Another introduction - http://lowfatlinux.com/linux-sed.html

...