Unix shell script to parse the contents of comma-separated file
Dear All,
I have a comma-separated file.
1. The first line of the file(header) should have 4 commas(5 fields).
2. The last line of the file should have 1 comma(2 fields).
Pls help me in checking this condition in a shell script.
And the number of lines between the first line and last line of the file, should match with the last field of the first and last line.
That is, the last field of first and last line wil have a number, that should match with {number of line in the file} -2.
Pls help me out with this.
Example file: QDB_2008.txt
1.1,20070427151500,99567,99669,0009
00001,20070427,00567,6012345671,2081,I
00002,20070427,00568,6012345672,2054,I
00003,20070427,00569,6012345673,2063,I
00004,20070427,00570,6012345674,2081,D
00005,20070427,00571,6012345675,2054,D
00006,20070427,00572,6012345676,2063,D
00007,20070427,00573,6012345677,2081,U
00008,20070427,00574,6012345678,2054,U
00009,20070427,00575,6012345679,2063,U
101.1.0,0009#
Regards,
Krishna