The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 05-27-2008
gobinath gobinath is offline
Registered User
  
 

Join Date: May 2008
Posts: 8
How to get the count only if two column matches?

Hi,

I have a file with the contents as below,
Code:
10:23:10        GOOD      10.30.50.60
10:23:11        GOOD      10.30.50.62
10:23:12        Hello        10.30.50.60
10:23:12        BAD         10.30.50.60
10:23:13        GOOD       10.30.50.66
10:23:14        BAD         10.30.50.62
10:23:15        Hello        10.30.50.66
10:23:16        Hello        10.30.50.66
10:23:16        BAD         10.30.50.66
I need the output like this,
Code:
No of Hello for  10.30.50.60: 1
No of Hello for  10.30.50.66: 2
Also
Code:
No of Hello for 10:23 (time) : 3
Please anyone suggest a script for this.

Thanks in advance

Last edited by Yogesh Sawant; 05-27-2008 at 03:29 AM.. Reason: added code tags