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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

filename+date

Status
Not open for further replies.

zyrag

IS-IT--Management
Dec 4, 2002
252
PH
i want to copy a text file into my home dir. The filename format that i want to create is something like filename+date.txt, e.g., txtfile0312.txt - where txtfile is the filename and 0312 is the current date. how do i extract the current date and append it to the filename.

thanks,
 
Check the man pages for date and strftime for more options on the date command. Something like this should work:

cp txtfile /directory/txtfile`date +%m%d`

This appends the month and day.

-jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top