bin/86514: awk -vVAR=val doesn't work without space after -v
Alexander Melkov
melkov at comptek.ru
Fri Sep 23 11:40:09 PDT 2005
>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 at 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:
More information about the freebsd-bugs
mailing list