Jan Schampera wrote:
Scott Mcdermott wrote:
Bash does not seem to take the last record if it has no
trailing delimiter:
I'm sure Chet accepts patches, if he thinks it's a bug. I'm not sure if
it's a bug per se, but at least it's a usability issue to discuss. Maybe
it can be reduced to "read re
On 2008-02-24, Scott Mcdermott wrote:
> Bash does not seem to take the last record if it has no
> trailing delimiter:
>
>
> $ echo "0 1 2^3 4 5^6 7 8" |
> while read -a array -d ^
> do echo $array
> done
> 0 3
>
> In this sense it does not behave like awk:
>
> $ echo "
Scott Mcdermott wrote:
> Bash does not seem to take the last record if it has no
> trailing delimiter:
>
>
> $ echo "0 1 2^3 4 5^6 7 8" |
> while read -a array -d ^
> do echo $array
> done
> 0 3
> This behavior is counter-intuitive. It just throws away the
> last line
Bash does not seem to take the last record if it has no
trailing delimiter:
$ echo "0 1 2^3 4 5^6 7 8" |
while read -a array -d ^
do echo $array
done
0 3
In this sense it does not behave like awk:
$ echo "0 1 2^3 4 5^6 7 8" |
awk -v RS=^ '{print $1}'
0 3