bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] BUG: Gawk interval expression metacharacter {} is not wor


From: Davide Brini
Subject: Re: [bug-gawk] BUG: Gawk interval expression metacharacter {} is not working as expected
Date: Sat, 18 Nov 2017 19:39:32 +0100

On Sat, 18 Nov 2017 12:13:04 -0500, "Quantum.Saturn"
<address@hidden> wrote:

> Hi,
> 
> I have reported the following bug with Ubuntu distribution.
> This needs to go upstream, so I reporting it here.
> 
> BUG DESCRIPTION:
> The interval expression metacharacter {} is not working as expected. The
> problem specifically being when the interval is defined on the first
> character of the string/record. Otherwise if the interval is defined on
> any other character apart from the first in the string then its working
> as expected.
> 
> INPUT FILE DATA: metacharfile
> jas
> jjas
> jjjas
> jjjjas
> jjjjjas
> 
> COMMAND:
> # gawk '/j{1,3}as/' ./metacharfile
> 
> EXPECTED RESULT:
> jas
> jjas
> jjjas
> 
> ACTUAL RESULT:
> jas
> jjas
> jjjas
> jjjjas
> jjjjjas

You forgot to anchor the expression to the beginning of the string to match.
Try with

# gawk '/^j{1,3}as/' ./metacharfile

-- 
D.



reply via email to

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