Hi,
I am cutting data from a fixed length test file and then writing out a new record using the echo command, the problem I have is how to stop multiple spaces from being written to the output file as a single space.
Example:
cat filea | while read line
do
field1=`echo $line | cut -c1-2`
field2=`echo $line | cut -c10-20`
field3=`echo $line | cut -c21-35`
echo $field1$field2$field3 >>outfile
done
Both field2 & field3 contain variable length text, the unused portion being space filled.