Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to: append date to the filename

Status
Not open for further replies.

zyrag

IS-IT--Management
Dec 4, 2002
252
PH
i want to output a log to a file with the filename format like 'filename110703.log' where 110703 is the current date. how do i append the date to a filename?
 
zyrag,
It's fairly stright forward. Just embed the date command in the file name. You could do something like:
Code:
my_program > filename`date +"%m%d%y`.log
Hope that helps.
 
thanks usige... touch test`date +'%m%d%y'` works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top