Unix

Hi,

Following is the code.

Test.sh
-------
lindata=""
cnt=`cat test.dat|wc -l`
i=1
while [ $i -le $cnt ];
do
v=`head -$i test.dat|tail -1`
echo $v
i=`expr $i + 1`
done
exit

I am having the data like this
Test.dat
--------
smith
jones xxxxx
smith jones "N/A "
"smith b "
'jones '

When i execute the test.sh, I got the following output:
smith
jones xxxxx
smith jones "N/A "
"smith b "
'jones '

Here the issue is spaces are removed as u check the test.dat and the output i got when i execute the statement. I want to display the output as the test.dat but it is not displaying.

Please suggest.

Thanks & Regards

Anybody can give the solution for the above issue.

Thanks & Regards,

Use:

v="`head -$i test.dat|tail -1`"
echo "$v" 

instead.
Regards.