Summary: Quick AWK help

From: Siva Singam Santhakumar (santha@stepsoft.com.au)
Date: Wed Aug 25 2004 - 00:20:32 EDT


Thanks to John F Wall (at us.ibm.com) for the quick and detailed reply.
Correct syntax:

/usr/sbin/netstat -an |grep ESTA |\
awk ' { split($4,a,".")
if (a[5] == "8005")
DEV++
if (a[5] == "8006")
PROD++
}
END { printf DEV, PROD }
'
I am using it on a Tru64 box, so please ignore the field I am working on.

Thanks Gurus

Siva Singam Santhakumar wrote:

> Dear Managers,
>
> Sorry for the OT
>
> What is wrong in this awk line?
>
> /usr/sbin/netstat -an |grep ESTA | awk
> '{split($4,a,".");if(a[4]=8005)DEV++;if(a[4]=8006)PROD++;print
> $DEV,$PROD} '
>
> In this line I am trying to get the total connections for ports 8005
> and 8006.
>
> Thanks

-- 
 
/Siva //S Santhakumar ( Santha)/
System Administrator
Stepsoft Pty Ltd
+ Unit 5, 11 National Circuit, BARTON   ACT   2600
Stepsoft is the developer of Foxtrot, an Enterprise
Customer Knowledge System (CKS).  Find out more
At www.stepsoft.com.au <http://www.stepsoft.com.au/>
 Email: santha@stepsoft.com.au
 Phone: (+61) 02 6233 0913
 Fax: (+61) 02 6233 0990
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers


This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:29:20 EDT