sed is a command-line stream editor for filtering and transforming text.
By far the most common usage of
sed is to perform a simple pattern replacement:
sed -e 's/pattern/replacement/g'
However, sed is Turing-complete; more complex scripts are possible, but quickly become cryptic. A good alternative for tasks that are complicated in sed is awk.
- GNU sed user's manual
- THE SED FAQ
- Is there a basic tutorial for grep, awk and sed?
- How to remove multiple lines per occurrence in a file?
- How to ensure that string interpolated into `sed` substitution escapes all metachars
- sed one-liner to delete any line that does not contain lowercase letters
- How to append end of every line with the line itself
- sed: get 2 lines from a single one
- Return only the portion of a line after a matching pattern
- Extracting a regex matched with 'sed' without printing the surrounding characters