Linux sed command (string editor)
The sed command on Linux is a powerful string editor for filtering or editing text strings.
The most common options are:
- -e: Adds a script to the commands to be executed;
- -f file: Adds the content of a file as a script to be executed;
- -r: Uses regular expressions in the script.
Examples:
To replace expressions with others, we use the “s”, with the “/” delimiters, so that the first occurrence is the text to search for, and the second the text that will be replaced. Note that sed will only exchange the first occurrence of each line, and is case-sensitive. The default output of sed will be the terminal.
Learn much more about Linux in our online course. You can register here. If you already have an account, or want to create one, just log in or create your user here.
Did you like it?
Share