q | Quit after a line (`/<pattern>/q` or `<integer>q`) | | x | x | | | |
d | Delete lines (`/<pattern>/d` or `<integer>d`) | | x | x | | | |
p | Print matched lines (`-n '/<pattern>/p'`) | Only with `-n` option | | x | | | |
p | Print matched lines (`-n '/<pattern>/p'` or `-n '<integer>p'`) | Only with `-n` option | | x | x | | |
a | Append text after a line (`/<pattern>/a Add new text after`) | On macOS (BSD sed) the command requires a backslash (`\`) and a newline. | | | x | | |
i | Insert text before a line (`/<pattern>/i Add new text before`) | On macOS (BSD sed) the command requires a backslash (`\`) and a newline | | | x | | |
c | Change entire line (`/<pattern>/c This is a new line`) | | | | x | | |