Awk processing and parsing -
trying use strictly awk solve little issue , can't wrap myself around solution:
# more connections 0x828ac008 127.0.0.1:5152 127.0.0.1:1387 2000 0x82cc28f8 10.4.4.63:1435 10.4.4.72:22 1132 0x82ec1de0 10.4.4.63:1524 50.28.90.36:8080 3248 # awk -f":" '/[0-9]/{print $1,$2}' connections | awk '!/^127/{print "nslookup "$4}' nslookup 127.0.0.1 nslookup 10.4.4.72 nslookup 50.28.90.36 i looking streamlined method parse out aside loopbacks ^127 , 10. addresses in netblock. yes, know can use sed, grep, cut, etc, i'm hoping see how else in awk. more of learning curve/a-ha! thing
clarifying: output omit 10.x.x.x , 127.x.x.x
output be
nslookup 50.28.90.36 i tried awk !/^127\.|^10\./ couldn't ignore values.
this awk should work:
awk -f "[: ]+" 'nr>1 && !($4 ~ /^(127|10)\./){print "nslookup", $4}' connections output:
nslookup 50.28.90.36
Comments
Post a Comment