The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Special Forums > UNIX and Linux Applications
Google UNIX.COM



Thread: Unix
View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 11-21-2007
ratna ratna is offline
Registered User
 

Join Date: Nov 2007
Posts: 8
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
Reply With Quote
Forum Sponsor