Editing Streams with sed
Explore the use of the sed command as a stream editor to modify text in pipelines or files. Understand basic and global substitution to replace text patterns, and practice these commands in the terminal. This lesson helps you learn how to edit text streams effectively using sed without altering the original files.
We'll cover the following...
The sed command
If we need to modify text in a pipeline or a file, sed is our best friend. Its name is short for “stream editor,” and it’s convenient. While we can do many things with sed, the most common use is to replace some text with other text, similar to how we use the find and replace feature in our text editor.
Like other tools, sed can read its input from a file or standard input. Let’s try it out. Print out Hello World and use sed to replace Hello with Goodbye:
$ echo ...