Hi all,
I have a directory have all of the .stat and .dat file :
they are is a pipe separate flat file.
Example:
log-20061202.stat contain 1st line and last line of log-20061202.dat with record count of that day.
Example:
Total record = 240
Tom|02-12-2006|1600 W.Santa Clara|SanJose|95123|1001|ENG <--first
Mike|02-12-2006|23 Clayton Rd|San Francisco|94127|6666|PHY <-- last
log-20061202.dat have
NAME|DATETIME|Address|City|Zip|StudentID|Class
Tom|02-12-2006|1600 W.Santa Clara|SanJose|95123|1001|ENG <-- first
John|02-13-2006|234 Wlliam Rd|Oakland|94321|2324|MATH
..............................................
Mike|02-12-2006|23 Clayton Rd|San Francisco|94127|6666|PHY <--last
For each new log-yyyymmdd.dat file compare the record count from the stat file with the record count of the dat file. Raise an error if they do not match.
For each log-yyyymmdd.stat file have the first and last record of the dat file, confirm the first and last record of the dat file are in stat file. Raise an error if they do not match.
For each record that we are going to output file, the file to output is controled by the DATE field of the .dat file not the timestamp contained in the file name.
The output will have name yyyymmdd.dat and contain
NAME|STUDENTID|CLASS
This is a hard problem for me, please help me to learn more how to use ksh shell to solve it. Thanks for sharing.