Ravi Sir's Cards › AWS
sed find and replace
This revision card explains sed find and replace. It starts from the need that edit text without opening files. It describes s/old/new/g replaces all. The how-to section notes -i edits in place; add.bak. An example on the card is change a port safely.
Read card text
What this card says
Why do we need it?
Edit text without opening files.
What is it?
s/old/new/g replaces all.
How to do it
-i edits in place; add .bak.
Example
Change a port safely.
sed -i.bak 's/8080/9090/g' app.conf