sed stands for stream editor. It's most commonly used for text replacement. This recipe covers many common sed techniques.
Using sed to perform text replacement
How to do it...
The sed command can replace occurrences of a pattern with another string. The pattern can be a simple string or a regular expression:
$ sed 's/pattern/replace_string/' file
Alternatively, sed can read from stdin:
$ cat file | sed 's/pattern/replace_string/'
If you use the vi editor, you will notice that the command to replace the text is very similar to the one discussed here. By default, sed only prints the substituted text, allowing it to be used in a pipe.
$ cat /etc/passwd | cut -d : -f1,3 | sed 's/:/ - UID: /' root - UID: 0 bin...