All I want is to look for the pattern in the file...If I found it at # places... I want print lines after those pattern(line) until I find a blank line.
Log EXAMPLE :
MT:Exception caught
The following Numbers were affected:
1234
2345
2346
Error
java.lang.InternalError: Can't connect to X11
Exception caught
The following numbers were affected:
11111
22222
33333
44444
55555
java.lang.InternalError: Can't connect to
This is the command I used
nawk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r[(NR-c+1)%b];print;c=a}b{r[NR%b]=$0}' b=0 a=10 s="The following numbers were affected:" Process.log
Above command gives me 10 lines after the search string.
But I just want the 3 and 5 lines in this case. I want to break the print if it hits the blank line.