a | Appends `text` after a line |
b | Branch unconditionally to `label` |
c | Replace (change) lines with `text` |
d | Delete the pattern space; immediately start next cycle |
D | If pattern space contains newlines, delete text in the pattern space up to the first newline, and restart cycle with the resultant pattern space, without reading a new line of input. If pattern space contains no newline, start a normal new cycle as if the d command was issued |
e | Executes the command that is found in pattern space and replaces the pattern space with the output; a trailing newline is suppressed |
F | Prints the file name of the current input file |
g | Replaces the contents of the pattern space with the contents of the hold space |
G | Appends a newline to the contents of the pattern space, and then appends the contents of the hold space to that of the pattern space |
h | Replaces the contents of the hold space with the contents of the pattern space |
H | Appends a newline to the contents of the hold space, and then appends the contents of the pattern space to that of the hold space |
i | Insert text before a line |
l | Prints the pattern space in an unambiguous form |
n | Prints the pattern space, then, regardless, replaces the pattern space with the next line of input. If there is no more input then sed exits without processing any more commands |
N | Adds a newline to the pattern space, then appends the next line of input to the pattern space. If there is no more input then sed exits without processing any more commands |
p | Prints the pattern space |
P | Prints the pattern space up to the first newline |
q | Exit sed without processing any more commands or input |
Q | This command is the same as q, but will not print the contents of pattern space |
r | Reads file |
R | Queue a line of filename to be read and inserted into the output stream at the end of the current cycle, or when the next input line is read |
s, regexp, replacement | Match the regular-expression against the content of the pattern space. If found, replace matched string with replacement |
t | (test) Branch to label only if there has been a successful substitution since the last input line was read or conditional branch was taken. The label may be omitted, in which case the next cycle is started |
T | (test) Branch to label only if there have been no successful substitutions since the last input line was read or conditional branch was taken. The label may be omitted, in which case the next cycle is started |
v | Makes sed fail if GNU sed extensions are not supported, or if the requested version is not available |
w | Writes the pattern space to the file |
W | Writes to the given filename the portion of the pattern space up to the first newline |
x | Exchanges the contents of the hold and pattern spaces |
y, src, dst | Transliterate any characters in the pattern space which match any of the source-chars with the corresponding character in dest-chars |
z | (zap) Empties the content of pattern space |
# | Comment until the next newline |