|
Awk, shell variables
Hello, I've been trying to figure out how to use variables inside the AWK command and use it back in the korn shell sript.
in my script I have lots of awk commands like this
grep Listen /etc/ssh/sshd_config | \
awk '{ if ($2 == "22" ) print "OK";
else print "not OK"
}'
I need to add a counter to count how many issues/problems I have, something like
x=0
grep Listen /etc/ssh/sshd_config | \
awk '{ if ($2 == "22" )
print "OK";
else
print "not OK"
x++
}'
# ... more of awk commands ...
echo x;
unfortunatelly x "inside" the awk command is different/local to awk command ... is there a way to do thi/
Thank you,
K.
|