How would I delete the 6 lines starting from every instance of a word i see?
I think this sed command will do what you want:
sed '/bar/,+5d' input.txt
It removes any line containing the text bar
plus the five following lines.
Run as above to see the output. When you know it is working correctly use the switch --in-place=.backup
to actually perform the change.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With