I was using the less
command to browse a very huge text log file (15 GB) and was trying to search for a multiline pattern but after some investigation, less
command can only search single line patterns.
Is there a way to use grep
or other commands to return the number line of a multiline pattern?
The format of the log is something like this in iterations of hundred thousands:
Packet A
op_3b : 001
ctrl_2b : 01
ini_count : 5
Packet F
op_3b : 101
ctrl_2b : 00
ini_count : 4
Packet X
op_3b : 010
ctrl_2b : 11
ini_count : 98
Packet CA
op_3b : 100
ctrl_2b : 01
ini_count : 5
Packet LP
op_3b : 001
ctrl_2b : 00
ini_count : 0
Packet ZZ
op_3b : 111
ctrl_2b : 01
ini_count : 545
Packet QEA
op_3b : 111
ctrl_2b : 11
ini_count : 0
And what I am trying to get is to have grep
or some other command to return the start of the line number of when these three line pattern occurs:
op_3b : 001
ctrl_2b : 00
ini_count : 0