Cutting specific line of a file by checking condition

testfile.csv

0","1125209",,"689202CBx18888",,"49",,,"NONMC",,,,,"01112010",,,,,,,"MTM-
"1","",,"689202ABx19005",,"49",,,"NONMC",,,,,"01072010",,,,,,,"MTM-

[]testfile.csv looks like above format
[
]if the second column is null then get 23rd column and store in a different varible .. add all the 23rd columns if 2nd column is null .
[*]cut the entire line if second column is null and store in another file
[/list]
All the above condition should be checked for the entire file

Please help me ..
if I use below code
cat testfile | cut -d "," -f 2 > id

then all the id including "" stored in a file

I don't know what you mean by "second column is null": should it contain a numerical zero ("0") or an empty string ("")? I assumed the latter and:

#!/bin/ksh
typeset -i iSum=0
typeset    chFlag=""
typeset    iValue=0

cat testfile.csv |\
cut -d',' -f2,23 |\
sed 's/,/ /' |\
while read chFlag iValue ; do
     if [ "$chFlag" = "\"\"" ] ; then
          eval iValue=$iValue
          (( iSum += iValue ))
     fi
done

print - "Sum is: $iSum"
exit 0

I hope this helps.

bakunin