![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| script to read a line with spaces bet " " and write to a file | perlamohan | Shell Programming and Scripting | 3 | 11-12-2008 04:27 AM |
| How to remove "New line characters" and "spaces" at a time | anushree.a | Shell Programming and Scripting | 4 | 09-08-2008 06:55 PM |
| How to timeout the "read" command | rm-r | Shell Programming and Scripting | 5 | 08-15-2008 12:22 PM |
| Breaking input with "read" command | vino | Shell Programming and Scripting | 2 | 08-04-2005 01:10 PM |
| how to request a "read" or "delivered" receipt for mails | plelie2 | Shell Programming and Scripting | 1 | 08-06-2002 04:26 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
"read" command ignoring leading spaces
I have to read a file line by line, change it and then update the file. Problem is, when i read the file, "read" command ignores leading spaces.
The file is a script which is indented in many places for clarity. How to i make "read" command read leading spaces as well. |
|
|||||
|
Quote:
Something like: Code:
while IFS= read -r ... Notice that some read implementations do not support the -r option. |
|
||||
|
Just would like to post a 'thank you' to radulov: After more than 1 year I found this thread and it exactly ansvering the question.
The option EFS= is works perfect (at least in my system) (the -r is not nessesary here) |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|