Sed

Sed A Stream Editor

Sed is a "non-interactive" stream-oriented editor. It is stream-oriented because, like many UNIX programs, input flows through the program and is directed to standard output. (vi, for instance, is not stream-oriented. Nor are most DOS applications.) Input typically comes from a file but can be directed from the keyboard. Output goes to the terminal screen by default but can be captured in a file instead. Sed works by interpreting a script specifying the actions to be performed.

Examples

to change all instances for "OldString" with "NewString"

cat file.txt | sed ' {s/OldString/NewString/g} ' > newfile.txt

s = Substitute, g = Global