for INSTANCE in $INSTANCES
do
ssh weblogic@${SERVER} "egrep \"^$SEARCHHOUR1:$SEARCHMIN1.*DEBUG.*LONG QUERY.* ms.\$|^$SEARCHHOUR2:$SEARCHMIN2.*DEBUG.*LONG QUERY.* ms.\$\" vgprod1/mw.log.$INSTANCE | awk '{ $(NF-1)>=10000 }' "
done
Error:
NF-1: command not found
awk: cmd. line:1: { >=10000 }
awk: cmd. line:1: ^ syntax error
I am getting the above error while executing on a Unix server. I guess I am missing backslash at some places in AWK. How can I fix this?
As noted by sarathi, your problem is an unquoted
$.It might be easier to spot if you split up the command:
Also note that
egrep '$pattern'will be expanded correctly when it is enclosed in double quotes.