[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] IFS & read
From: |
Geir Hauge |
Subject: |
Re: [Help-bash] IFS & read |
Date: |
Sat, 26 May 2012 21:05:13 +0200 |
2012/5/26 Bill Gradwohl <address@hidden>:
> I have a file that uses the tab character as the separator.
>
> Writing a read loop against that file works just fine and I get field
> separation.
>
> I converted that file by replacing the tab character with \b and changed the
> IFS to match and now I don't get field separation.
>
> I also tried \x00 and \x01 and they don't work either.
>
> What are the allowable IFS characters as far as read is concerned?
Everything's allowed except NUL (which bash variables can't hold), and
whitespace is treated specially. To use \b as field separator, do
while IFS=$'\b' read -r var1 var2; do ...
--
Geir Hauge
Re: [Help-bash] IFS & read, Stephane Chazelas, 2012/05/26