I am trying to parse large log file by grep strings between 2 different patterns
example :
line1
line2
...
lineN
pattern1
line4
line6
pattern2
....
other lines
pattern1
line8
line9
pattern2
...
The lines I need to catch is the part between pattern1/pattern2 (so, line4
through line6
and line8
through line9
).
I am using
sed -n '/pattern1/,/pattern2/p
to search the file , but it takes really long time to complete (yeah, my log file is large ...)
I am wondering is there a more efficient way to speed up the search? Ideally a single line command (awk/grep etc...) or Python.