Ravi Sir's Cards › AWS
sed in 4 steps
This revision card explains sed in 4 steps. It starts from the need that preview a replace. It describes edit with backup. The how-to section notes print some lines. An example on the card is delete comments.
Read card text
What this card says
Why do we need it?
Preview a replace.
sed "s/8080/9090/g" app.conf
What is it?
Edit with backup.
sed -i.bak "s/8080/9090/g" app.conf
How to do it
Print some lines.
sed -n "10,20p" app.log
Example
Delete comments.
sed "/^#/d" app.conf