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

Question on command "Date" option

Status
Not open for further replies.

3042

Vendor
Sep 19, 2003
12
TH
Is there any option for date command to delete '0' in front of the day and the month in case it has a single letter
==================
Current Output :
date +%Y%m%d
20040504
date +%Y%m%d
20041124
==================
Wanted output
200454
20041124
===================
I have a script which generating filename as 200454.log but I want it to have like 20040504.log for furthur statistic.I could not modified in that script but only to have an additional script to manipulate the file name on the output file.Please recommend.
 
Hi,
Im don't think that there is an option like this, because this would result in an ambiguous time format:
December 3rd and January 23 both would be 2004123.
So, if your business needs require this format, you will have to manipulate the date string by some other methods.
sed, cut, awk, ...?
I can't think of a quick method just now, but there should be one.
regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top