From owner-freebsd-questions Fri Nov 23 22:31:28 2001 Delivered-To: freebsd-questions@freebsd.org Received: from dc-mx04.cluster1.charter.net (dc-mx04.cluster0.hsacorp.net [209.225.8.14]) by hub.freebsd.org (Postfix) with ESMTP id 2AFA937B416 for ; Fri, 23 Nov 2001 22:31:25 -0800 (PST) Received: from [24.158.214.244] (HELO gforce.johnson.home) by dc-mx04.cluster1.charter.net (CommuniGate Pro SMTP 3.4.6) with ESMTP-TLS id 53212550 for questions@freebsd.org; Sat, 24 Nov 2001 01:37:41 -0500 Received: (from glenn@localhost) by gforce.johnson.home (8.11.6/8.11.6) id fAO6VMY02867 for questions@freebsd.org; Sat, 24 Nov 2001 00:31:22 -0600 (CST) (envelope-from glenn) From: Glenn Johnson Date: Sat, 24 Nov 2001 00:31:22 -0600 To: questions@freebsd.org Subject: date conversion in awk Message-ID: <20011124063122.GA2811@gforce.johnson.home> Mail-Followup-To: glenn@FreeBSD.ORG, questions@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.23.2i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I have a set of files that have, as part of their content, dates in the following format: 23-Nov-01 I need to convert the format to: 11/23/2001 I know how to do the conversion with the date command for a single value but I can not quite figure out how to parse through the file with awk to change the format. What I have come up with so far is to extract the date field from the file and save those values in a variable. I then loop over the contents of the variable, do the conversion, and write them out to a file. I then run awk on the original file to get whatever else I need and then paste the results of this and the dates file into another file using the paste command. This works but it seems that I should be able to do the date conversion while in awk without having to write the converted dates out to an intermediate file. Any help appreciated. Thanks. -- Glenn Johnson glennpj@charter.net To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message