I have a text log file that contains several entries like this:
Processing input.jpg (323 of 500)...
Detecting matches in region 1...
Detecting matches in region 2...
Detecting matches in region 3...
Detecting matches in region 4...
Detecting matches in region (n)...
...
NOT ENOUGH MATCHES - FULL FILE OUTPUT
Processing input1.jpg (324 of 500)...
I want the grep file to correspond to each instance where the FULL FILE sequence appears, and then get the name of the file that generated this result - find the initial processing of the line before each FULL FILE.
How to do this with grep or another tool like sed or awk?
So far I can match every instance in which the FULL FILE is in the log and count them:
cat output.txt | grep "FULL FILE" | wc -l
but I need to get the previous file name from the log file for each match.
Any help is greatly appreciated.
source
share