Date: Fri, 23 Sep 2005 18:36:26 GMT From: Alexander Melkov <melkov@comptek.ru> To: freebsd-gnats-submit@FreeBSD.org Subject: bin/86514: awk -vVAR=val doesn't work without space after -v Message-ID: <200509231836.j8NIaQgG082275@www.freebsd.org> Resent-Message-ID: <200509231840.j8NIe8eq036335@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 86514
>Category: bin
>Synopsis: awk -vVAR=val doesn't work without space after -v
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Sep 23 18:40:08 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator: Alexander Melkov
>Release: 5.4
>Organization:
>Environment:
FreeBSD melkov.ru 5.4-STABLE FreeBSD 5.4-STABLE #5: Tue Jun 7 01:38:07 MSD 2005 forspam@melkov.ru:/usr/obj/usr/src/sys/MELKOV i386
>Description:
As freebsd-used awk was changed from gawk to 'real' awk in 5.x, all the shell scripts that set awk variables in a style -vVAR=val will silently produce incorrect results.
>How-To-Repeat:
# echo azb | awk -Fz -vOFS=q '{print $1,$2}'
a b
# echo azb | awk -Fz -v OFS=q '{print $1,$2}'
aqb
# echo azb | gawk -Fz -vOFS=q '{print $1,$2}'
aqb
>Fix:
workaround:
1. install gawk
2. replace awk binary with gawk or put gawk into /usr/sbin as awk (/usr/sbin is normally before /usr/bin in $PATH).
>Release-Note:
>Audit-Trail:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200509231836.j8NIaQgG082275>
