The UNIX and Linux Forums  


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 -->
  #4 (permalink)  
Old 06-05-2009
aemunathan aemunathan is offline
Registered User
  
 

Join Date: May 2008
Posts: 75
Hi panyam and Franklin

i followed the method suggested by panyam its giving useful result.

here it goes as in the order i requested.


Code:
1.
awk '$4=="BSNLSERVICE1"&&$6=="2128" { count++ } END { print "BSNLSERVICE1-->2128-->" count }' 20090604*

2. 

awk '$4=="BSNLSERVICE1"&&$6=="2128"{ b[$14]++}  END {for(i in b){print i, b[i]}  }' 20090604*

3.
awk '$4=="BSNLSERVICE1"&&$6=="2128"{ b[$9]++}  END {for(i in b){print i, b[i]}  }' 20090604*

one thing i need to know whether its possible to derive filename from date command.

actually i need to schedule it every night at 2:00 am and i need to derive the filename from the date command

lets take the example
tonight 2.00 am the ouput of the

Code:
date +'%Y%m%d'

is 20090606
i need to give the file name as 20090605* in the filename part of the awk ...


and for franklin ....i used this way

Code:
#!/usr/xpg4/bin/awk 
awk -v day="20090605" -v serv="BSNLSERVICE1" -v val="2128" '
$1 ~ day && $4==serv && $6==val {
  s1++;a[$14]++;b[$9]++
}
END{
  print serv,val, "=" s1 "\n"
  print serv,val, a["SUCCESS"]
  print serv,val, a["SYSTEM"] "\n"
  for(i in b){print i, b[i]} 
}' 200906051859

and got the response as
Quote:
./reconcil.sh
/usr/xpg4/bin/awk: syntax error Context is:
>>> ./ <<<
thank u