Pete Pete - 1 year ago 80
Bash Question

Delete all lines containing a caret (^)

I tried

sed -i '/^/d' myfile
and it deleted the entire file. How to avoid this? I want to remove all lines with
^
in it.

Answer Source
sed -i '/\^/d' myfile

You need to escape the ^ special character.