Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Sep 2012 23:59:10 GMT
From:      Devin Teske <dteske@FreeBSD.org>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/171725: awk(1) does not support word-boundary metacharacters
Message-ID:  <201209172359.q8HNxAdj073704@red.freebsd.org>
Resent-Message-ID: <201209180000.q8I00MEq009096@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         171725
>Category:       bin
>Synopsis:       awk(1) does not support word-boundary metacharacters
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Sep 18 00:00:21 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Devin Teske
>Release:        FreeBSD 9.0-RELEASE i386
>Organization:
FIS Global, Inc.
>Environment:
FreeBSD push900.vicor.com 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan  3 07:15:25 UTC 2012     root@obrian.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
The awk(1) manual describes (quote) "regular expressions are as in egrep; see grep(1)."

This leads one to believe that awk(1) supports both basic REs and extended REs.

A discrepancy/gap has been found in this stated coverage.

one-true-awk (our awk(1)) does not support the word-boundary metacharacters (\< and \>) for matching beginning- and ending-of-word.
>How-To-Repeat:
$ echo xxxa | awk '/xxx\>/{print}'
### this produces no output, as-is expected since
### the word "xxxa" does not end in "xxx"

$ echo xxx | awk '/xxx\>/{print}'
### this too produces no output, indicating that
### \> is not a valid metacharacter for "end-of-word"

>Fix:
There are two proposed solutions.

1. Add a note to the awk(1) manual stating it does not support all RE metacharacters (note that '\<' and '\>' are valid both as BRE and ERE).

or

2. Enhance awk(1) to support these BRE/ERE metacharacters so that the awk(1) manual is accurate without a patch.

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209172359.q8HNxAdj073704>