This question already has an answer here:
I've got a tcpdump file.
I want to remove certain packets. They are easy to spot because they have
0x0000: a6a6 a6a6 a6a6 a6a6 ........
as the first line of data.
The full packet looks (mutatis mutandis) like:
16:24:46.132673 00:35:1a:71:91:37 (oui Unknown) > 05:05:05:c5:05:05 (oui Unknown), ethertype Unknown (0x88be), length 60: 0x0000: a6a6 a6a6 a6a6 a6a6 0101 2400 00b4 b83e 0x0010: 931f 00be 7c80 545a 0202 0000 0000 00a5 0x0020: a5a5 a500 0000 0000 0000 0000 0000
So what I'd like to say is:
"Remove lines that contain this pattern, and the line before the pattern, and the two lines after it".
Sed or awk or grep would be good, e.g.
$ sed -i 'magic' file
Any ideas what goes in place of magic?