How to remove all lines from file, starting from a known line, using sed
This command will look for a line starting with volumes: and remove all lines after said line from the file (including the line starting with volumes: itself).
remove_lines_from_volumes.sh
sed -i -e '/^volumes:/,$d' myfileremove_lines_from_volumes.sh
sed -i -e '/^volumes:/,$d' myfileThe command edits the file in-place (-i), no copy (or backup) of the file will be created.
Check out similar posts by category:
Linux
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow