Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 May 1996 00:13:18 +0200
From:      Wolfram Schneider <wosch@campa.panke.de>
To:        Charles Owens <owensc@enc.edu>
Cc:        bugs list FreeBSD <freebsd-bugs@FreeBSD.org>
Subject:   bug in awk
Message-ID:  <199605262213.AAA16115@campa.panke.de>
In-Reply-To: <Pine.FBS.3.93.960524091252.252E-100000@dingo.enc.edu>
References:  <Pine.FBS.3.93.960524091252.252E-100000@dingo.enc.edu>

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

awk-3.0 has this bug too.

try

$ ls -1 *.doc \
    | awk -F. '{ print "cp " $1 ".doc /usr/local/man/cat1/" $1 ".1" }'

Wolfram

Charles Owens writes:
>Awk seems to have a problem, perhaps associated with the use of the FS
>variable.  (Bug seen with FreeBSD 2.1-stable a la 3/16/96)  Allow me to
>demonstrate:
>
>I have a directory with the following files :
>   crc.doc         minirb.doc      rz.doc          sz.doc
>
>I want to remame them to foo.1 and stick them in /usr/local/man/cat1.
>Accordingly, I do the following (which ultimately would be piped to a
>shell, of course):
>
>  ls -1 *.doc \
>    | awk '{FS="."; print "cp " $1 ".doc /usr/local/man/cat1/" $1 ".1" }'
>
>This produces:
>  cp crc.doc.doc /usr/local/man/cat1/crc.doc.1
>  cp minirb.doc /usr/local/man/cat1/minirb.1
>  cp rz.doc /usr/local/man/cat1/rz.1
>  cp sz.doc /usr/local/man/cat1/sz.1
>
>Note the problem that the first line has.  This behavior is repeatable,
>using different field separators, etc.   I'm no awk expert, but it sure
>looks like a bug to me...



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