Examples
|
Command |
Action performed |
|
|
Substitute on all lines (all occurrences). |
|
|
Delete lines containing |
|
|
Print between |
|
|
Delete any line that doesn’t
contain |
|
|
Substitute on all lines, except
between |
Braces ({ }) are used in
sed to nest one address inside
another or to apply multiple commands at a single matched
address.
[/pattern/[,/pattern/]]{command1command2}
The opening curly brace must end its line, and the closing curly brace must be on a line by itself. Be sure there are no spaces after the braces.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access