From owner-freebsd-bugs Sun May 26 17:25:22 1996 Return-Path: owner-bugs Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id RAA21666 for bugs-outgoing; Sun, 26 May 1996 17:25:22 -0700 (PDT) Received: from mail.cs.tu-berlin.de (root@mail.cs.tu-berlin.de [130.149.17.13]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id RAA21641 for ; Sun, 26 May 1996 17:25:02 -0700 (PDT) Received: from campa.panke.de (anonymous223.ppp.cs.tu-berlin.de [130.149.17.223]) by mail.cs.tu-berlin.de (8.6.12/8.6.12) with ESMTP id CAA26431; Mon, 27 May 1996 02:22:12 +0200 Received: (from wosch@localhost) by campa.panke.de (8.6.12/8.6.12) id AAA16115; Mon, 27 May 1996 00:13:18 +0200 Date: Mon, 27 May 1996 00:13:18 +0200 From: Wolfram Schneider Message-Id: <199605262213.AAA16115@campa.panke.de> To: Charles Owens Cc: bugs list FreeBSD Subject: bug in awk In-Reply-To: References: Reply-to: Wolfram Schneider MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-bugs@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk 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...