Clear Case, Awk and script

Hello. I should have asked this awhile ago but here is my situation. My task is to generate LOC for different directories. I have a text file that has dates in this format (01-Aug-2006). My task is to read each line and compare it to a branch date. Depending on the date, it should generate a particular config_spec. Once that is done, another script loads the config_specs one by one and performs LOC counts. Here is the first step:


#!/bin/ksh

#THE OBJECTIVE OF THIS SCRIPT TO READ IN A TEXT FILE THAT #CONTATINS DATES IN A DD-MMM-YYYY FORMAT. EACH LINE IS READ AND #THE DATES ARE COMPARED TO A BENCHMARK DATE. DEPENDING ON THE #DATE, A CONFIG SPEC IS CREATED AND THAT CONFIG SPEC IS USED 
#BY ANOTHER SCRIPT TO PRODUCE THE METRICS OF PROGRAM CODE ON THE SYSTEM.

#NOW, WE OPEN THE TEXT FILE
exec 3<week_ending_dates.txt		

#HERE BEGINS A WHILE LOOP. AS THE FILE IS BEING READ LINE BY LINE, #EACH DATE IS READ AND THEN THE DATE IS TRUNCATED INTO THREE #VARIABLES. NEXT, THE VARIABLE, MONTH, IS TESTED AND SET TO A #NUMERICAL VALUE. 

	while read -u3 LINE 
	do			
		day=$(echo $LINE | cut -d'-' -f1)
		month=$(echo $LINE | cut -d'-' -f2)
		year=$(echo $LINE | cut -d'-' -f3)

		case $month in
		Jan*)month=01;;
		Feb*)month=02;;
		Mar*)month=03;;
		Apr*)month=04;;
		May*)month=05;;
		Jun*)month=06;;
		Jul*)month=07;;
		Aug*)month=08;;
		Sep*)month=09;;
		Oct*)month=10;;
		Nov*)month=11;;
		Dec*)month=12;;	
		esac

#THE DATE IS NOW PUT BACK TOGETHER TO BE COMPARED TO THE #BENCHMARK
	testdate=$year$month$day  
	branchdate="20070814"


# IF THE DATE WE ARE TESTING IS OLDER THAN THE BENCHMARK, CREATE A PARTICULAR CONFIG_SPEC. OTHERWISE, PRINT THE OTHER TYPE OF CONFIG_SPEC
	
	if [[ $testdate -lt $branchdate ]]
	then
	
echo 'Generating config spec files........'

more week_ending_dates.txt | grep Jan | awk '{ print "time "$1 " \n element * .../wint_sp75_dev/LATEST \n element * .../main/LATEST " > "config_"$1}'  
	more week_ending_dates.txt | grep Feb | awk '{ print "time "$1 " \n element * .../wint_sp75_dev/LATEST \n element * .../main/LATEST " > "config_"$1}' 
	more week_ending_dates.txt | grep Mar | awk '{ print "time "$1 " \n element * .../wint_sp75_dev/LATEST \n element * .../main/LATEST " > "config_"$1}' 
	more week_ending_dates.txt | grep Apr | awk '{ print "time "$1 " \n element * .../wint_sp75_dev/LATEST \n element * .../main/LATEST " > "config_"$1}' 
	more week_ending_dates.txt | grep May | awk '{ print "time "$1 " \n element * .../wint_sp75_dev/LATEST \n element * .../main/LATEST " > "config_"$1}' 
	more week_ending_dates.txt | grep Jun | awk '{ print "time "$1 " \n element * .../wint_sp75_dev/LATEST \n element * .../main/LATEST " > "config_"$1}'
	more week_ending_dates.txt | grep Jul | awk '{ print "time "$1 " \n element * .../wint_sp75_dev/LATEST \n element * .../main/LATEST " > "config_"$1}'
	more week_ending_dates.txt | grep Aug | awk '{ print "time "$1 " \n element * .../wint_sp75_dev/LATEST \n element * .../main/LATEST " > "config_"$1}'
	more week_ending_dates.txt | grep Sep | awk '{ print "time "$1 " \n element * .../wint_sp75_dev/LATEST \n element * .../main/LATEST " > "config_"$1}'
	more week_ending_dates.txt | grep Oct | awk '{ print "time "$1 " \n element * .../wint_sp75_dev/LATEST \n element * .../main/LATEST " > "config_"$1}'
	more week_ending_dates.txt | grep Nov | awk '{ print "time "$1 " \n element * .../wint_sp75_dev/LATEST \n element * .../main/LATEST " > "config_"$1}'
	more week_ending_dates.txt | grep Dec | awk '{ print "time "$1 " \n element * .../wint_sp75_dev/LATEST \n element * .../main/LATEST " > "config_"$1}'	
		
else 
	
echo 'Generating config spec files........'	
more week_ending_dates.txt | grep Jan | awk '{ print "time "$1 " \n element * .../wint_main/LATEST \n element * .../main/LATEST " > "config_"$1}' 

more week_ending_dates.txt | grep Feb | awk '{ print "time "$1 " \n element * .../wint_main/LATEST \n element * .../main/LATEST " > "config_"$1}'
 
more week_ending_dates.txt | grep Mar | awk '{ print "time "$1 " \n element * .../wint_main/LATEST \n element * .../main/LATEST " > "config_"$1}' 

more week_ending_dates.txt | grep Apr | awk '{ print "time "$1 " \n element * .../wint_main/LATEST \n element * .../main/LATEST " > "config_"$1}'
 
more week_ending_dates.txt | grep May | awk '{ print "time "$1 " \n element * .../wint_main/LATEST \n element * .../main/LATEST " > "config_"$1}' 


more week_ending_dates.txt | grep Jun | awk '{ print "time "$1 " \n element * .../wint_main/LATEST \n element * .../main/LATEST " > "config_"$1}'

more week_ending_dates.txt | grep Jul | awk '{ print "time "$1 " \n element * .../wint_main/LATEST \n element * .../main/LATEST " > "config_"$1}'

more week_ending_dates.txt | grep Aug | awk '{ print "time "$1 " \n element * .../wint_main/LATEST \n element * .../main/LATEST " > "config_"$1}'

more week_ending_dates.txt | grep Sep | awk '{ print "time "$1 " \n element * .../wint_main/LATEST \n element * .../main/LATEST " > "config_"$1}'

more week_ending_dates.txt | grep Oct | awk '{ print "time "$1 " \n element * .../wint_main/LATEST \n element * .../main/LATEST " > "config_"$1}'

more week_ending_dates.txt | grep Nov | awk '{ print "time "$1 " \n element * .../wint_main/LATEST \n element * .../main/LATEST " > "config_"$1}'

more week_ending_dates.txt | grep Dec | awk '{ print "time "$1 " \n element * .../wint_main/LATEST \n element * .../main/LATEST " > "config_"$1}'	
fi

done	
exec 3<&- 

Here are my issues and questions:

a) instead of finding the month, the script goes through all the lines of code (if Jan was read in, it will go through the rest before exiting. how do i break when the month is found/

b) when i read in dates, it seems that one particular config-spec is assigned to all dates (this includes dates that should be a different config-spec). how do i ensure that the config-spec changes accordingly.

c) is there an effecient way to accomplish my task.

Thanks for your help.