Quantcast
Channel: How to remove multiple lines per occurrence in a file? - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 3

How to remove multiple lines per occurrence in a file?

$
0
0

Say I have this 857835 line file, containing stuff like this:

a1
rubbish1
rubbish2
rubbish3
rubbish4
a1
rubbish5
rubbish6
rubbish7
rubbish8

And I wish to remove all occurences of a1 and the next line (rubbish1 and rubbish5 in this example). How do I do it?

I've tried grep 'a1' -v -A1 to no avail, and my sed skillz are not really great :}

My Google-fu has not been able to help me this time, someone please help!


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images