How do you delete all lines in a file that begin with \"string\" in sh? I was thinking about using the sed command.
You can use Vim in Ex mode:
ex -sc g/^string/d -cx file
g
select all matching lines
d
delete
x
save and close
sed and grep in your answers are missing their friend awk:
awk '!/^string/' inputfile > resultfile
To do it in place, if your sed supports the -i option, you can do:
sed -i '/^string/d' input-file
grep -v '^string' yourfile.txt > stripped.txt