First Occurence

Hi,
This is the format of the file that i have
StartDate:10/01/06
EndDate :10/02/06

Cno Ccode
1 10
2 11

StartDate:10/03/06
EndDate :10/04/06

Cno Ccode
2 13
4 12

StartDate:10/01/06
EndDate :10/02/06

Cno Ccode
3 10
2 15

I need the first occurence of startdate and end date in a seperate file...
So the new file should have a row with values of
10/01/06,10/02/06

Can some help me writing the script

Thanks
Kiran

awk -F: '/StartDate/{dt1=$2;getline;print dt1","$2;exit}' file > dtfile

can you specify what exactly shld go in o/p file as ur question is not very clear

This is the O/p that should i see...
10/01/06,10/02/06

$ awk -F: '{ print $2 }' inputdata.txt | sed 'N;s/\n/ /'
10/01/06 10/02/06

10/03/06 10/04/06

10/01/06 10/02/06

awk -F: '{ print $2 "," }' inputdata.txt | sed -e 'N;s/\n/ /' | sed 's/,$//' | sed 's/^,//'

this one gives what you want but not good to have so many piped o/p's