Ravi Sir's Cards › AWS
sed line commands
This revision card explains sed line commands. It starts from the need that pick, delete or add lines. It describes np print, d delete, a/i add. The how-to section covers how to use -n with p. An example on the card is drop comments and blanks.
Read card text
What this card says
Why do we need it?
Pick, delete or add lines.
What is it?
Np print, d delete, a/i add.
How to do it
Use -n with p.
Example
Drop comments and blanks.
sed '/^#/d;/^$/d' my.cnf