I need help writing a Unix Script, using Korn Shell (#!/usr/bin/ksh).
Basically, the script reads a file with the filename CAL_yyyymmdd (yyyymmdd changes everyday).
In the CAL_yyyymmdd file, the script needs to skip the first line of text and starts reading the second line. The script should first check the third column (which states C or F).
If the second line, third column reads a C, then it takes the date from the second column from the right (missing out the C), the value 20090220 and it puts this value into a file called tom.dat.
If the script reads the second line, third column and finds its a F, it then continues to move on to the next line, third column.
When it reads the next line, third column and finds a C, the script should take the date from the second column, from the right (missing out the C), take the value 20090223 and write it to a file called dayaftertom.dat.
Once the script has read the second C from the third column, it should quit. This script is to take tomorrow's date and the date of the day-after-tomorrow and write it out to a file.
I've attached the file from which the Script needs to read its data from.
011100 852009022016004020090220C C 120090225
011100 852009022016004020090221C F 000000000
011100 852009022016004020090222C F 000000000
011100 852009022016004020090223C C 120090226
011100 852009022016004020090224C C 120090227
011100 852009022016004020090225C C 120090302