Notes

Can use ‘|’ instead of ‘/’.

UjnotesCC0 1.0

Can use ‘|’ instead of ‘/’.

Replace all <prev> with <new>
‘s/<prev>/<new>/[g]’ <input_file> > <output_file>

Can use ‘|’ instead of ‘/’.

i

Inplace.

Replace and save the same file.

Backup is created if extension is supplied.

e

script - additional commands to be executed

Multiple

Multiple -e ‘s/<prev_1>/<new_1>/g’ -e ‘s/<prev_2>/<new_2>/g’
'<n>d'

Deletes nth line.

Escape

/\/ > \

Replace with new line

echo "a,b" | sed -e $'s/,/\\\n/g'
Updated: 2026 Aug 19