I need to differentiate between first image and second image scenarios when retrieveing information using grep. They both are created_at but one is for image and one is for tweet. All the ones for tweet have a },
in the line above so I thought I could use that information however I am not sure how I could do this.
Here's the grep I use:
grep -wirnE 'Wed Oct 19 2(1:[0-5][0-9]:[0-5][0-9]|2:([0-2][0-9]:[0-5][0-9]|30:00)) .* 2016' *
Best Answer
You can use the options
-A1
and-B1
to letgrep
print the line after (-A) and before (-B) the matching line. Try the following command line,I tested with the following input file named
log-file
Testing sequence