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!

Date format in awk

Status
Not open for further replies.

mzh

Programmer
Jan 31, 2000
1
US
Friends:<br>
<br>
Is there anybody who can help me to format Date result in awk program?<br>
I usede &quot;DATE&quot; ¦ getline dd<br>
printf (dd)<br>
and got something like this:<br>
Fri Jan 28 09:53:04 CST 2000<br>
<br>
Question:<br>
<br>
If I want to format it as CCYYMMDDhhmmss, do you know any simple way<br>
in AWK instead of spliting the whole line and then process each part?<br>
With this way, the month (&quot;Jan&quot; here) needs to be converted to &quot;01&quot; by <br>
some coding lines. It's easy but I just guess maybe there is a straitforward <br>
way in awk I have not known. <br>
<br>
Any idea?<br>
<br>
mzh<br>
<br>
Please send answer to <A HREF="mailto:mz_huang@hotmail.com">mz_huang@hotmail.com</A>
 
Not sure what you mean here ... but the Unix command ;<br>
<br>
date '+%Y%m%d%H%M%S'<br>
<br>
will return the current date in the format you need. Post again if you need more help.<br>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top