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 -->
  #5 (permalink)  
Old 02-09-2009
cdlaforc cdlaforc is offline
Registered User
  
 

Join Date: Feb 2009
Posts: 4
Try this.

Save the below code in chris2.awk
{

if (substr($1,1,5)=="Store") {

if (NAME!="")
{
printf("%15s:%15s Deployments\n", NAME, COUNT)
}

COUNT=0
NAME=$1

}
else
{
COUNT=COUNT+1

}
}

and if your input file is chris2.txt then run the below command.
awk -f chris2.awk chris2.txt


Thanks,


Chris.