bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] Issues in readfile example in docs


From: Arnold Robbins
Subject: Re: [bug-gawk] Issues in readfile example in docs
Date: Tue, 10 Oct 2017 13:00:04 +0300
User-agent: Heirloom mailx 12.5 6/20/10

Hi.

This note (unexcusably) got buried in my inbox.  You are correct.
I have fixed the doc, and it will get pushed to the git repo shortly,
and will be included in the upcoming 4.2 release.

Thank you very much!

Arnold

> From: Jaromir Obr <address@hidden>
> Date: Sat, 03 Sep 2016 07:09:11 +0000
> Message-ID: <address@hidden>
> To: "address@hidden" <address@hidden>
> Subject: [bug-gawk] Issues in readfile example in docs
> X-BeenThere: address@hidden
>
> Hi,
> see https://www.gnu.org/software/gawk/manual/gawk.html#Readfile-Function
>
> 1) There is missing the left parenthesis in while (getline tmp < file) > 0),
> thus you get a syntax error
> 2) The function doesn't process well new lines. If you have a file with
> EOLN at the end of file, the EOLN is missing in contents. And if the file
> doesn't have the ending EOLN, there is missing the last but one EOLN in
> contents.
>
> This works for me:
>
>     contents = tmp RT
>     while ((getline tmp < file) > 0)
>         contents = contents tmp RT
>
>
> instead of the existing code:
>
>     contents = tmp
>     while ((getline tmp < file) > 0)
>         contents = contents RT tmp
>
>
> Regards
>
> Mira




reply via email to

[Prev in Thread] Current Thread [Next in Thread]