I have a script which I want to delete every line after a specific line.
I have a command, but it just wipes the entire file?
sed -n '/twm &/q;p' ~/.xinitrc > ~/.xinitrc
Convert something like:
some line
another line
some other line
twm &
more lines to be deleted
and more
To
some line
another line
some other line
sponge
(a moreutils tool). In the end, these three variation (counting the one in this answer too) does the same thing, either explicitly or behind the scenes. – Kusalananda Sep 26 '23 at 18:06