help-gawk
[Top][All Lists]
Advanced

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

Re: inconstancy with RS = "(\r?\n){2}"


From: Alex fxmbsw7 Ratchev
Subject: Re: inconstancy with RS = "(\r?\n){2}"
Date: Sat, 24 Jul 2021 14:14:01 +0200

i dont have such coloring, the input is 'foo\nbar\n\n\n\n..none\n'
then it prints the first time, then two control-d's or three are
needed to print the rest and end
..

gawk -v RS='(\r?\n){2}' -v ORS= '{ print "-" NR, $0, RT }'

foo
bar






none
-1 foo
bar

-2

-3

-4
none


On Sat, Jul 24, 2021 at 7:28 AM Wolfgang Laun <wolfgang.laun@gmail.com> wrote:
>
> I'm not sure what you did to demonstrate that this setting does not work. But 
> this is the awk program I tried:
>    BEGIN { RS="(\r?\n){2}" }
>    NR % 2 == 1 { print NR " " $0; }
> and this is how I ran it (using 5.1.0), program output shown with a green 
> background:
> /tmp$ gawk -f doublers.awk
> abc
> def
>
> ghi
> jkl
> 1 abc
> def
>
> mno
> pqr
>
> stu
> vwx
> 3 mno
> pqr
> /tmp$
>
> HTH
> -W
>
> On Sat, 24 Jul 2021 at 04:39, Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com> wrote:
>>
>> i tried this in my httpd project, but it doesnt result anything
>>
>> gawk -v RS="(\r?\n){2}" 1
>>
>> two enters it doesnt catch also
>>
>> it when entered some data sometimes needs multiple control d s to proceed \
>> end
>
>
>
> --
> Wolfgang Laun
>



reply via email to

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