The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



Thread: Awk ...
View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 02-16-2007
Amruta Pitkar Amruta Pitkar is offline
Registered User
 

Join Date: Aug 2006
Posts: 54
Awk ...

This is how my input file is .
< IM.OMNI #5.2.2 SMTP; 552 cq05c.my.corp.root: your "received:" header counts of 16 exceeds maximum setting 15>
adjsahdjas kasdks 91039 sdf
sdhsahsah dfkdsjf 23948 jfkdsljf
< IM.OMNI #3.2.2 SMTP; 552 cq05c.my.corp.root: your "received:" header counts of 16 exceeds maximum setting 15>
sdkjfkdsjfkdsljfksd
sdjfdkjfdksfj

I am trying the following :
/[[#][0-9][.][0-9][.][0-9]/
{
if ((/#4.4.6/) || (/#5.1.1/) || (/#5.2.2/) || (/#4.2.2/) || (/#5.2.1/))
{ valid_rec++; }
else
{invalid_rec++; }
}
But this is not giving me the correct count. invalid_rec is incremented for every word.
Increment must happen for every line.
Please guide.
I want the valid_rec = 1 and invalid_rec = 1. How do I achieve this with awk ?
Reply With Quote
Remove advertisements
!!
Forum Sponsor