Basically I want to take as input text from a file, remove a line from that file, and send the output back to the same file. Something along these lines if that makes it any
There's also ed (as an alternative to sed -i):
ed
sed -i
# cf. http://wiki.bash-hackers.org/howto/edit-ed printf '%s\n' H 'g/seg[0-9]\{1,\}\.[0-9]\{1\}/d' wq | ed -s file_name