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: Garrett Cooper
Subject: Re: User error or gawk bug?
Date: Fri, 15 Jan 2010 14:09:30 -0800

    Hmm.. turns out that the { } regexp quantifiers were my cause of
error. Replacing \/{2,} with \/\/ did the trick.
Thanks,
-Garrett

On Fri, Jan 15, 2010 at 1:20 PM, Garrett Cooper <address@hidden> wrote:
>    This is the expected behavior by the way (in perl):
>
> address@hidden ~ $ SLASHES="////////" ; perl -e '$ARGV[0] =~
> s#/{2,}#/#; print "$ARGV[0]\n";' $SLASHES
> /
>
>    I'm trying to avoid using perl though, because the probability of
> an embedded device having awk is much greater than it having perl, and
> the overhead involved with perl is much greater than awk of course.
> Thanks,
> -Garrett
>
> On Fri, Jan 15, 2010 at 1:00 PM, Garrett Cooper <address@hidden> 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,}/, "")
>>
>>   I expect it to squish all duplicate `/' in $0. Interestingly
>> enough, it doesn't match my expected behavior:
>>
>> address@hidden ~]$ SLASHES="////////" ; test "$(echo "$SLASHES" |
>> awk '{ gsub (/\/{2,}/, ""); print }')" = "$SLASHES"; echo $?
>> 0
>>
>>   I've tried this same code on RHEL 4.6 (uses gawk), Gentoo Linux
>> (uses gawk), and my FreeBSD CURRENT box (uses nawk), and the results
>> are the same. So, my question is: did I do something wrong, or
>> accidentally stumble on an *awk bug?
>




reply via email to

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