Date: Thu, 2 Aug 2012 14:17:38 +0100 From: RW <rwmaillists@googlemail.com> To: freebsd-questions@freebsd.org Subject: Re: buggy awk regex handling? Message-ID: <20120802141738.62ef1e45@gumby.homeunix.com> In-Reply-To: <743721353.9443.1343906452119.JavaMail.sas1@172.29.249.242> References: <743721353.9443.1343906452119.JavaMail.sas1@172.29.249.242>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 02 Aug 2012 13:20:52 +0200 kaltheat wrote: > > > Hi, > > I tried to replace three letters with three letters by awk using the > sub-routine. I assumed that my regular expression does mean the > following: > > match if three letters of any letter of alphabet occurs anywhere in > input > > $ echo AbC | awk '{sub(/[[:alpha:]]{3}/,"cBa"); print;}' > AbC > > As you can see the result was unexpected. > When I try doing it for at least one letter, it works: > > $ echo AbC | awk '{sub(/[[:alpha:]]+/,"cBa"); print;}' > cBa > ... > What am I doing wrong? > Or is awk buggy? Traditional awk implementations don't support {n}, but I think POSIX implementations should.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120802141738.62ef1e45>