A solução será muito específica para o seu arquivo de dados, já que as citações não foram devidamente removidas. Como há apenas uma coluna de problemas, é bem factível. Aqui vai você:
#!/bin/bash
while IFS='' read -r line || [[ -n "$line" ]]; do
echo "Line: $line"
# grabbing the first field is easy ..
f1=$(echo $line | cut -d, -f1 )
# now remove the first field from the line
line=$(echo $line | sed "s/$f1,//" )
echo "Line is now: $line"
# to grab the second field use quote as a delimiter
f2=$(echo $line | cut -d\" -f2 )
# now remove the second field from the line
line=$(echo $line | sed "s/\"$f2\",//" )
echo "Line is now: $line"
# fields 3,4,5 are trivial .. just repeat the same pattern as 1 and then remove them
f3=$(echo $line | cut -d, -f1 )
line=$(echo $line | sed "s/$f3,//" )
echo "Line is now: $line"
f4=$(echo $line | cut -d, -f1 )
line=$(echo $line | sed "s/$f4,//" )
echo "Line is now: $line"
f5=$(echo $line | cut -d, -f1 )
line=$(echo $line | sed "s/$f5,//" )
# here is the "trick" ... reverse the string, then you can cut field 7 first!
line=$(echo $line | rev)
echo "Line is now: $line"
f7=$(echo $line | cut -d, -f1 )
# now remove field 7 from the string, then reverse it back
line=$(echo $line | sed "s/$f7,//" )
f7=$(echo $f7 | rev)
# now we can reverse the remaining string, which is field 6 back to normal
line=$(echo $line | rev)
# and then remove the leading quote
line=$(echo $line | cut --complement -c 1)
# and then remove the trailing quote
line=$(echo $line | sed "s/\"$//" )
echo "Line is now: $line"
# and then double up all the remaining quotes
f6=$(echo $line | sed "s/\"/\"\"/g" )
echo f1 = $f1
echo f2 = $f2
echo f3 = $f3
echo f4 = $f4
echo f5 = $f5
echo f6 = $f6
echo f7 = $f7
echo $f1,\"$f2\",$f3,$f4,$f5,\"$f6\",$f7 >> fixed.txt
done < "$1"
Eu fiz isso ecoar muitos resultados para mostrar como funciona, você pode remover todas as instruções de eco para torná-lo mais rápido depois de entendê-lo. Acrescenta a linha fixa a fixed.txt .
Aqui está um exemplo de execução e saída:
[root@alpha ~]# ./fixit.sh test.txt
Line: MMP,"01_janitorial,02_cleaning_tools",1,,CUBIC_INCH,"(14) tray capacity, 6" upright with 3" spacing, mounts on 48"W x 24"D, taupe epoxy, fits MetroMax i & MetroMax Q shelf, NSF",CLEANING
Line is now: "01_janitorial,02_cleaning_tools",1,,CUBIC_INCH,"(14) tray capacity, 6" upright with 3" spacing, mounts on 48"W x 24"D, taupe epoxy, fits MetroMax i & MetroMax Q shelf, NSF",CLEANING
Line is now: 1,,CUBIC_INCH,"(14) tray capacity, 6" upright with 3" spacing, mounts on 48"W x 24"D, taupe epoxy, fits MetroMax i & MetroMax Q shelf, NSF",CLEANING
Line is now: ,CUBIC_INCH,"(14) tray capacity, 6" upright with 3" spacing, mounts on 48"W x 24"D, taupe epoxy, fits MetroMax i & MetroMax Q shelf, NSF",CLEANING
Line is now: CUBIC_INCH,"(14) tray capacity, 6" upright with 3" spacing, mounts on 48"W x 24"D, taupe epoxy, fits MetroMax i & MetroMax Q shelf, NSF",CLEANING
Line is now: GNINAELC,"FSN ,flehs Q xaMorteM & i xaMorteM stif ,yxope epuat ,D"42 x W"84 no stnuom ,gnicaps "3 htiw thgirpu "6 ,yticapac yart )41("
Line is now: (14) tray capacity, 6" upright with 3" spacing, mounts on 48"W x 24"D, taupe epoxy, fits MetroMax i & MetroMax Q shelf, NSF
f1 = MMP
f2 = 01_janitorial,02_cleaning_tools
f3 = 1
f4 =
f5 = CUBIC_INCH
f6 = (14) tray capacity, 6"" upright with 3"" spacing, mounts on 48""W x 24""D, taupe epoxy, fits MetroMax i & MetroMax Q shelf, NSF
f7 = CLEANING
Se você precisar escapar das citações de alguma outra maneira, isso deve ser bastante óbvio, considerando o que foi dito acima.