Sed is a non-interactive text stream editor for editing a copy of text from a file or from standard input. Standard input can be text entered from the keyboard, a file redirection, a string or a variable, or by a pipe. So what would you use sed for? After all, vi is also a text editor. Well, sed allows you to edit small or large files on the fly; you can supply a series of sed commands to edit or delete and off it goes and does the job. Sed does all the changes in one pass, thus making it efficient and, most importantly to the user, fast.
In this chapter we will cover:
matching with regular expressions;
adding, appending and substitution; and
basic sed one-liners and scripts.
You supply ...