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

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

Re: bug? using pattern matching with gawk


From: Davide Brini
Subject: Re: bug? using pattern matching with gawk
Date: Wed, 4 Aug 2010 15:29:37 +0100
User-agent: KMail/1.13.3 (Linux/2.6.32-gentoo-r10; KDE/4.4.4; x86_64; ; )

On Wednesday 04 Aug 2010 11:21:21 taha wrote:

> I'm trying to replace all the "NULL" strings in the first columns of a file
> by the string "NULLL" . I've read the documentation
> before doing this, the documentation says that gawk will do an EXACT
> pattern match for the value "NULL" and will replace it by "NULLL" OK.
> 
> The problem is, when I have a field in this column like 'abcdNULL', it will
> be matched, and replaced by 'abdcNULLL', so it's not really an EXACT
> pattern matching, but a partial one in this case.
> 
> Here's the typed command:
> 
>  gawk '$1=="NULL"{$1="NULLL"}{print $0}' file
> 
> my gawk version: GNU Awk 3.1.8
> 
> uname -as : Linux 2.6.33.5-124.fc13.i686.PAE #1 SMP Fri Jun 11 09:42:24 UTC
> 2010 i686 i686 i386 GNU/Linux
> 
> 
> Please tell me if it's a bug, or a bug in the documentation, or if it's
> simply something that I don't understand,
> 
> I hope that I was clear in my explanation, I'm looking forward to hearing
> from you,

"Works for me":

$ echo 'abdcNULL foo bar' | gawk '$1=="NULL"{$1="NULLL"}{print $0}'
abdcNULL foo bar

My gawk is 3.1.6 but I would be *very* surprised if later versions broke 
something that basic.

-- 
D.



reply via email to

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