Summary: Quick AWK help

From: Siva Singam Santhakumar (santha_at_stepsoft.com.au)
Date: 08/25/04

  • Next message: abdel.mabrouk_at_kabira.co.uk: "SSH problems"
    Date: Wed, 25 Aug 2004 14:20:32 +1000
    To: sunmanagers@sunmanagers.org
    
    

    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
    

  • Next message: abdel.mabrouk_at_kabira.co.uk: "SSH problems"