From owner-freebsd-bugs Fri May 24 13:21:43 1996 Return-Path: owner-bugs Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id NAA23846 for bugs-outgoing; Fri, 24 May 1996 13:21:43 -0700 (PDT) Received: from irz301.inf.tu-dresden.de (irz301.inf.tu-dresden.de [141.76.1.11]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id NAA23808 for ; Fri, 24 May 1996 13:21:30 -0700 (PDT) Received: from sax.sax.de by irz301.inf.tu-dresden.de (8.6.12/8.6.12-s1) with ESMTP id WAA22333; Fri, 24 May 1996 22:21:25 +0200 Received: by sax.sax.de (8.6.12/8.6.12-s1) with UUCP id WAA24856; Fri, 24 May 1996 22:21:24 +0200 Received: (from j@localhost) by uriah.heep.sax.de (8.7.5/8.6.9) id WAA23587; Fri, 24 May 1996 22:03:26 +0200 (MET DST) From: J Wunsch Message-Id: <199605242003.WAA23587@uriah.heep.sax.de> Subject: Re: bug in awk To: owensc@enc.edu Date: Fri, 24 May 1996 22:03:26 +0200 (MET DST) Cc: freebsd-bugs@FreeBSD.org Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch) In-Reply-To: from Charles Owens at "May 24, 96 09:27:26 am" X-Phone: +49-351-2012 669 X-PGP-Fingerprint: DC 47 E6 E4 FF A6 E9 8F 93 21 E0 7D F9 12 D6 4E X-Mailer: ELM [version 2.4ME+ PL17 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-bugs@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk As Charles Owens wrote: > 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 > Note the problem that the first line has. This behavior is repeatable, I think this is expected behaviour. The first line has been parsed, using the default FS value. *After* parsing it, you're going to set FS to a new value, so it will affect the next (and all following) lines. The correct ways to do it: . use the -F . option, or . use ``awk 'BEGIN {FS="."} {print "cp " $1 ...}' '' -- cheers, J"org joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-)