logo

sed Cheatsheet

Last Updated: 2024-01-28

Add One Line To The Beginning

$ sed -i '1s/^/line to insert\n/' /path/to/file

Remove 1st line in place

$ sed -i 1d filename

Add comma to the end of the line

$ cat foo.txt | sed s/$/,/g

Remove https://

$ ... | sed s#https://##`