From owner-freebsd-questions Sat Jun 13 23:41:10 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id XAA27507 for freebsd-questions-outgoing; Sat, 13 Jun 1998 23:41:10 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from stratos.net (pm3-1-23.stratos.net [207.86.132.23]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id XAA27501 for ; Sat, 13 Jun 1998 23:41:02 -0700 (PDT) (envelope-from drifter@stratos.net) From: drifter@stratos.net Received: (from drifter@localhost) by stratos.net (8.8.8/8.8.5) id CAA05538; Sun, 14 Jun 1998 02:41:30 -0400 (EDT) Message-ID: <19980614024130.B4548@stratos.net> Date: Sun, 14 Jun 1998 02:41:30 -0400 To: Dave Bender , Design at Carolina Marketing Cc: "faq@FreeBSD.ORG" Subject: Re: Unix commands References: <01BD96B4.12894E70@MANNY> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.91.1i In-Reply-To: <01BD96B4.12894E70@MANNY>; from Dave Bender on Sat, Jun 13, 1998 at 09:04:59AM -0500 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sat, Jun 13, 1998 at 09:04:59AM -0500, Dave Bender wrote: > One solution would be: > > $ date | awk '{print "mv yourfile $2.html"}' | sh > > > date returns the date and pipes it to awk, which prints your command, > sticking in field 2 ($2), which is the month. Then the whole thing > gets fed to a shell, which executes it. > How about: $ mv yourfile `date | awk '{print $2$3-$4.html}'` or alternatively: $ mv yourfile $(date | awk '{print $2$3-$4.html}') The latter looks nicer, and is supported by the FreeBSD /bin/sh, although I think older versions of the Bourne Shell don't recognize it. -Drifter -- drifter@stratos.nospam.net (remove nospam to send) "Ever notice that in every commercial about the Internet, advertising geniuses can't resist having a bunch of kids staring into a monitor, awe- struck, looking at a whale jumping out of the ocean? Or is it just me?" To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message