Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 May 1996 09:27:26 -0400 (EDT)
From:      Charles Owens <owensc@enc.edu>
To:        bugs list FreeBSD <freebsd-bugs@freebsd.org>
Subject:   bug in awk
Message-ID:  <Pine.FBS.3.93.960524091252.252E-100000@dingo.enc.edu>

next in thread | raw e-mail | index | archive | help
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...

---
-------------------------------------------------------------------------
  Charles Owens                                  Email:  owensc@enc.edu
                                       "I read somewhere to learn is to
  Information Technology Services     remember... and I've learned that
  Eastern Nazarene College            we've all forgot..."   - King's X
-------------------------------------------------------------------------




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.FBS.3.93.960524091252.252E-100000>