I am writing a shell script program to extract some exceptions from a log file and do some processing.
Currently I am using the below command in my script to capture the line nos in the log file that has an exception. The exception lines will contains ERROR keyord just after date and timestamp
lineNos=($(grep -n ERROR $file | grep Exception | cut -d':' -f1 | tail -3))
While testing the current script, I noticed that some log entries contains ERROR and Exceptions in the same row but which is not actually the kind of ERROR that I am looking for(Example line 5) I would like to modify my script in such a way that it will return only the line no 3 in the below example log.
2016-10-21 15:25:37,231 INFO Processinng current row
2016-10-21 15:25:37,231 INFO com.test.main com.test.controller.CrashException:
2016-10-21 15:25:37,231 ERROR com.test.main com.test.controller.CrashException:
2016-10-21 15:25:37,231 DEBUG com.test.main com.test.controller.CrashException:
2016-10-21 15:25:37,231 DEBUG Processing row with ERROR and Exception
2016-10-21 15:25:37,231 DEBUG processed row 1: