I have a process that I am trying to provide a solution for and have hit a brick wall and would like some pointers in the right direction.
Basically on a daily basis a report is automatically generated in a CSV format (FIRST.CSV) which includes codes and amounts in the following format:
A016ZZ ,, 1400.43
A011ZZ ,, 15000.98
B014ZZ ,, -450.83
B027ZZ ,, 86.90
.....
The amounts can be negative or positive. The codes on the other hand always have to begin with A or B and have to always end with ZZ.
Anyway after this file has been scrutinised it usually needs some amendments, however to amend the file a second CSV file (SECOND.CSV) file is created manually in the same format as above. That is codes and the corresponding values.
These 2 files then need to be merged which is fine, but before it can be merged the second file (SECOND.CSV) needs to have some checks run on to ensure each code begins with an A or B followed by three numrical figures followed by the 'ZZ'post fix.
Could anyone assist as to how this check can be done. I have got as far as this:
if [ `cat ${SECOND.CSV} | egrep -v '^L|^M' | wc -l` -gt 0 ]
then
print "code other than A or B present."
exit 1
fi