bug-gawk
[Top][All Lists]
Advanced

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

Re: feature request: only set RT when RS is found


From: Ed Morton
Subject: Re: feature request: only set RT when RS is found
Date: Wed, 15 Sep 2021 17:06:57 -0500
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0



On 9/15/2021 1:52 PM, Ole Petter R?nningen wrote:
Hi

I am sure this has been discussed many times, yet my google-fu has failed to 
come up with some rationale.

As you know, gawk sets the variable RT to whatever matches RS, if RS is a regex. If EOF 
is reached mid-line and RS is therefore not matched, the record is terminated but RT is 
NOT set. This is a good way to detect possible "partial lines", for example 
when processing through a live log-file.

My proposal is that this behaviour is extended to include the case when RS is a 
single character such as '\n'. If RS is not found, it should IMHO not be 
signalled as found by setting RT.

Thank you,
Ole

Do you have an example of the problem? I can't reproduce what I think you're saying happens:

$ printf 'foo' | awk '{print "<" RT ">"}'
<>

$ printf 'foo' | awk -v RS='x' '{print "<" RT ">"}'
<>

In all cases RT is not set.

Regards,

    Ed.



reply via email to

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