Need Help to count the deployments

Hi,
Need help for a script that count no of deployments from the below Sample Input file.

Below is my sample input file. Not sure whether it works or not.
Note: (We can use a seperator if needed)
My output should come like for each Store:

Output should look like:
Store_MS1: 4 Deployments
Store_MS2: 3 Deployments
--MS3
..MS8: 1 Deployment
__________________________________
Sample Input file:
__________________________________

Successfully connected to Admin Server 'Store_Adm' that belongs to domain 'Store_CITY_XXX'.

Warning: An insecure protocol was used to connect to the
server. To ensure on-the-wire security, the SSL port or
Admin port should be used instead.

Location changed to serverRuntime tree. This is a read-only tree with DomainMBean as the root.
For more help, use help(domainConfig)

Location changed to domainRuntime tree. This is a read-only tree with DomainMBean as the root.
For more help, use help(domainRuntime)

Store_MS1
RxP_01.00.16.00_PT
Security_01.00.16.00_PT
PreEditEngine_01.00.16.00_PT
RxPConfig_01.00.16.00_PT
Store_MS2
Security_01.00.16.00_PT
PreEditEngine_01.00.16.00_PT
RxPConfig_01.00.16.00_PT
Store_MS3
PreEditEngine_01.00.16.00_PT
RxP_01.00.16.00_PT
Store_MS4
PreEditEngine_01.00.16.00_PT
Sore_MS5
PreEditEngine_01.00.16.00_PT
Store_MS6
RxP_01.00.16.00_PT
Store_MS7
PreEditEngine_01.00.16.00_PT
RxP_01.00.16.00_PT
RxPConfig_01.00.16.00_PT
Security_01.00.16.00_PT
Store_MS8
PreEditEngine_RxC_01.00.16.00_PT

Thanks in advance.

nawk '/Store_.*/ {a[$1]++} END { for(i in a) printf("%s: %d Deployments\n", i, a)}' mySampleFile

I run this, but got output as:
Store_MS1: 1 Deployments
Store_MS2: 1 Deployments
Store_MS3: 1 Deployments
Store_MS4: 1 Deployments
Store_MS6: 1 Deployments
Store_MS7: 1 Deployments
Store_MS8: 1 Deployments
.. But it supposed to be 4, 3 etc...

sorry, misunderstood what you wanted - hopefully this is what you wanted:

nawk '/Store_.*/ {id=$1;next} {a[id]++} END { for(i in a) printf("%s: %d Deployments\n", i, a)}' mySampleFile

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.

it works.. Thanks for all your quick help.

You may try this

#!/usr/bin/ksh
i=0;
j=0;
while read Record
do
 if [ ${Record:0:8} == "Store_MS" ]
 then
      if [ $i !=  0 ]
      then
         printf "number of deployments= %d\n" $j
         j=0;
      fi
      i=1;
      printf "%s " $Record;
 elif [ $i == 1 ]
 then
      j=`expr $j + 1`
 fi
done  < input_file
printf "number of deployments= %d\n" $j