bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: User error or gawk bug?


From: Micah Cowan
Subject: Re: User error or gawk bug?
Date: Fri, 15 Jan 2010 16:36:37 -0800
User-agent: Thunderbird 2.0.0.23 (X11/20090817)

Garrett Cooper wrote:
> Hi GNU folks,
>    While testing out something to emulate $(abspath ) in GNU make
> 3.81+, I tried wrote the following in awk:
>
>    gsub (/\/{2,}/, "")

You've stumbled on one of awk's (not gawk's) quirks. It supports
extended regexes, but they _don't_ support "intervals" (the "{2,}"), as
you've discovered. They were added in by POSIX, but gawk doesn't support
them automatically by default, because it would break too many awk
scripts that use "{" and "}" for their literal meanings (this is
explained in the manual).

You can force gawk to support them with --re-interval or --posix, but
IMO you're better off avoiding them, unless you're certain you'll be
using gawk (Ubuntu systems, for instance, install "mawk" as the default
awk).

-Micah




reply via email to

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