Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

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.

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

Here a simple example of replacing the word original with new in a file called notes.txt.

sed -i 's/original/new/' notes.txt

I use the -i to not have sed automatically create a backup file.

References

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

Using sed to edit and save to the same file - http://unstableme.blogspot.ca/2010/01/sed-save-changes-to-same-file.html

  • No labels