Hi,
I have a text file with the following format. Some of the fields are blank.
1234 3456 23 45464 327837283232 343434
5654353 34 34343 3434345 434242
....
....
....
I need to convert this file to a CSV file, like
1234, ,23, ,454,64,3278,3728,3232, ,343,434
Here is my code:
inputFile="test"
outputFile="test.csv"
while read line
do
f1=`echo $line | cut -c1-4`
f2=`echo $line | cut -c5-8`
f3..
f4..
..
..
echo "$f1,$f2,$f3....." >> $outputFile
done < $inputFile
but in the outputFile, all the blank are erased. Can anyone help me out here?
Thanks!!:o