lorcan,
here is the output when i ran in the debug mode-
ksh -x newfinalscript testingdata
+ inpFile=testingdata
+ outFile=/home/NamishT/Outputnew.txt
+ tmpFile1=/tmp/sample1.txt
+ tmpFile2=/tmp/sample2.txt
+ sortFile=/tmp/sortfile.txt
+ TOTAL_FILEDS=9
+ COUNT=1
+ rm -f /home/NamishT/Outputnew.txt
+ cat testingdata
+ + sed s/00,*//g;s/,$//g
+ echo 00,11,21,00,00,55,00,73,83,07,00,22,39,43,00,66,00,00,00,15,00,00,44,58,67,00,87
+ wc -c
count_fields= 45
+ + echo 00,11,21,00,00,55,00,73,83,07,00,22,39,43,00,66,00,00,00,15,00,00,44,58,67,00,87
+ cut -d, -f1-9
+ sed s/00,*//g;s/,$//g
+ wc -c
cnt_flds1= 15
+ + echo 00,11,21,00,00,55,00,73,83,07,00,22,39,43,00,66,00,00,00,15,00,00,44,58,67,00,87
+ cut -d, -f10-18
+ wc -c
+ sed s/00,*//g;s/,$//g
cnt_flds2= 15
+ + echo 00,11,21,00,00,55,00,73,83,07,00,22,39,43,00,66,00,00,00,15,00,00,44,58,67,00,87
+ wc -c
+ sed s/00,*//g;s/,$//g
+ cut -d, -f19-27
cnt_flds3= 15
+ [[ 45 -eq 45 ]]
+ [[ 15 -eq 15 ]]
+ [[ 15 -eq 15 ]]
+ [[ 15 -eq 15 ]]
+ echo 00,11,21,00,00,55,00,73,83,07,00,22,39,43,00,66,00,00,00,15,00,00,44,58,67,00,87
+ sed s/\(.\{26\}\),\(.\{26\}\),\(.\{26\}\).*/\1\n\2\n\3/g
+ 1> /tmp/sortfile.txt
+ [[ 1 -le 9 ]]
+ cut -d, -f1 /tmp/sortfile.txt
+ grep -v 00
+ 1> /tmp/sample1.txt
+ cut -d, -f1 /tmp/sortfile.txt
+ sort
+ grep -v 00
+ 1> /tmp/sample2.txt
+ diff /tmp/sample1.txt /tmp/sample2.txt
+ 1> /dev/null
+ [[ 0 -eq 1 ]]
+ [[ ! -s /tmp/sample1.txt ]]
+ echo Check the 1 field of the line: 00,11,21,00,00,55,00,73,83,07,00,22,39,43,00,66,00,00,00,15,00,00,44,58,67,00,87
Check the 1 field of the line: 00,11,21,00,00,55,00,73,83,07,00,22,39,43,00,66,00,00,00,15,00,00,44,58,67,00,87
+ rm -f /tmp/sample1.txt /tmp/sample2.txt /tmp/sortfile.txt
+ exit 256