Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Jun 1998 09:04:59 -0500
From:      Dave  Bender <bendede@startribune.com>
To:        Design at Carolina Marketing <design@carolinamarketing.com>
Cc:        "faq@FreeBSD.ORG" <faq@FreeBSD.ORG>
Subject:   RE: Unix commands
Message-ID:  <01BD96B4.12894E70@MANNY>

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



----------
From: 	Jason C. Wells
Sent: 	Friday, June 12, 1998 8:11 AM
To: 	Design at Carolina Marketing
Cc: 	faq@FreeBSD.ORG
Subject: 	Re: Unix commands

On Fri, 12 Jun 1998, Design at Carolina Marketing wrote:

>Hello,
>
>    I am new to Unix and I am looking for a command that will allow me to
>rename(mv) a file according to what month it is.  I thought i remember
>reading something like [mv $.html], but i can't find it now.  This is to
>rename a generated page produced by a cron file.

You would have to write a script to do this. The script would use a
combination of 'mv' 'cp' and 'date'.

It should be fairly trivial to write this script.

Catchya Later,		|	UW Mechanical Engineering
Jason Wells		|	http://weber.u.washington.edu/~jcwells/
			|	206-633-5994


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



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?01BD96B4.12894E70>