Date: Sun, 14 Jun 1998 02:41:30 -0400 From: drifter@stratos.net To: Dave Bender <bendede@startribune.com>, Design at Carolina Marketing <design@carolinamarketing.com> Cc: "faq@FreeBSD.ORG" <faq@FreeBSD.ORG> Subject: Re: Unix commands Message-ID: <19980614024130.B4548@stratos.net> In-Reply-To: <01BD96B4.12894E70@MANNY>; from Dave Bender on Sat, Jun 13, 1998 at 09:04:59AM -0500 References: <01BD96B4.12894E70@MANNY>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980614024130.B4548>
