I know how to remove all lines contening a pattern with
sed -i '/pattern/d' file
But how should I remove the line AND the next line ?
For example, with the following file, I want to remove all 'Apple' and next fruit
Apple
Peach
Lemon
Apple
Banana
Peach
Expected Output:
Lemon
Peach
Someone know how to do that ?
Could you please try following(written and tested in GNU sed).
sed '/Apple/,+1 d' Input_file
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