The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to append spaces(say 10 spaces) at the end of each line based on the length of th prathima UNIX for Dummies Questions & Answers 2 04-29-2008 02:43 PM
remove leading spaces from a line lijojoseph Shell Programming and Scripting 6 03-17-2008 02:29 AM
Reading a line including spaces aksarben UNIX for Dummies Questions & Answers 1 09-19-2007 04:39 PM
adding spaces to a line mgirinath Shell Programming and Scripting 4 03-23-2007 09:38 AM
To Trim spaces at the end of line sbasetty Shell Programming and Scripting 1 01-31-2007 07:01 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 09-22-2006
Registered User
 

Join Date: Aug 2006
Posts: 45
line containig spaces

hi i have file having following contain

2~%%~2~%%~7~%%~1~%%~none~%%~XYZ_MOV_HDR_REC~%%~1~%%~17_REC_ID == "H"
2~%%~2~%%~8~%%~2~%%~none~%%~XYZ_MOV_EXCL~%%~2~%%~20_UPC<=99999999

see the last column of first line having spaces i have a script

cat rec_iden_file
for i_line in `cat rec_iden_file`
do
echo $i_line
done

here i am printing each line of file
but as first line has a space in last column output of script is

-------------------------------
2~%%~2~%%~7~%%~1~%%~none~%%~XYZ_MOV_HDR_REC~%%~1~%%~17_REC_ID == "H"
2~%%~2~%%~8~%%~2~%%~none~%%~XYZ_MOV_EXCL~%%~2~%%~20_UPC<=99999999
2~%%~2~%%~7~%%~1~%%~none~%%~XYZ_MOV_HDR_REC~%%~1~%%~17_REC_ID
==
"H"
2~%%~2~%%~8~%%~2~%%~none~%%~XYZ_MOV_EXCL~%%~2~%%~20_UPC<=99999999
-------------------------
see the first line treated as 3 lines...

any pointers why this is happening and solution for it

thanks
mahabunta
Reply With Quote
Forum Sponsor
  #2  
Old 09-22-2006
Registered User
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,397
By default IFS is space. If you want to print the whole line then set IFS to some character that is not in the file

or use this

Code:
cat rec_iden_file
while read i_line
do
echo $i_line
done < rec_iden_file
Reply With Quote
  #3  
Old 09-22-2006
Registered User
 

Join Date: Aug 2006
Posts: 45
thanks anubh while loop worked...
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 04:25 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0