can someone help me with this. i keep getting errors:
var1="MaxClients"
var2="java|could not.*problem found|panic() failure seen|aborting [ERROR]"
awk 'NR>=1&&NR<=10 && /'${var1}'/ && !/'${var2}'/ {++c}c==3{o=$0 RS $0 RS $0; print o; c=0}' log
when i run the above, i keep getting:
awk: NR>=1&&NR<=10 && /MaxClients/ && !/java|could
awk: ^ unterminated regexp
if anybody is able to fix the above, i'm also interested in how i can modify it so it gives the count of lines returned, instead of showing the lines. something like:
awk 'NR>=1&&NR<=10 && /'${var1}'/ && !/'${var2}'/ {++c}c==3{o=$0 RS $0 RS $0; print o; c=0}' log
4