![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| 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 !! |
|
|
||||
| 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 |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
thanks anubh while loop worked...
|
|||
| Google The UNIX and Linux Forums |