Home » Infrastructure » Linux » date field in file name
date field in file name [message #181065] Thu, 06 July 2006 10:10 Go to next message
alanm
Messages: 284
Registered: March 2005
Senior Member

Hi,
From my previous topic I want to try and get the script to produce a log file which includes the date stamp

ie

> daily_report.`date "+\%Y\%m\%d_\%H\%M"`.log 2>&1

from other cron jobs on the system this produces something similar to

/tmp/load_addresses.20060706_1201.log
so you can see that the date and time are nicely formated. However when I run with the above syntax I get the following output

daily_report.\2006\07\06_\16\02.log

how can I remove the '\' characters

regards

Alan.

ps I do not know how to script and am just picking it up as I go along
Re: date field in file name [message #181077 is a reply to message #181065] Thu, 06 July 2006 11:28 Go to previous message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
YYMMDDHHMM=`date +%y%m%d_%T`
echo YYMMDDHHMM
Previous Topic: creating a cron job fails
Next Topic: Listener Problem on Suse 9.3 and Oracle 10g
Goto Forum:
  


Current Time: Fri Apr 19 09:08:31 CDT 2024