awk date convert

awk '{cmd="date --date=\""$1"\" +\"%Y/%m/%d %H:%M:%S\" "; cmd | getline convdate; print cmd";"convdate }' file.txt
Convert readable date/time with `date` command
Sample Output
date --date="Mon Feb 27 12:06:58 2012" +"%Y/%m/%d %H:%M:%S";2012/02/27 12:06:58
date --date="Mon Feb 27 12:11:15 2012" +"%Y/%m/%d %H:%M:%S";2012/02/27 12:11:15
date --date="Mon Feb 27 12:12:47 2012" +"%Y/%m/%d %H:%M:%S";2012/02/27 12:12:47

2012-02-28 14:08:52

What Others Think

This command converts the field in date correctly. Is there any way to print record iff the converted date "cmd" is before sysdate?
amitpyd · 314 weeks and 4 days ago
It is ideal if the illuminating toy that is picked plays music, regardless of whether that it isn't the fundamental purpose behind party of the toy. Check this">homepage to get more info. A melodic toy won't just be fun and attracting for a youthful grown-up to play with, it would show them a ton.
Ahmed74 · 42 weeks ago
Other than appearing for three hours dependably, I am moreover drinking Chocolate milk constantly. This source homepage also help in the achievement of your goals. Drinking this is encouraging me particularly in fulfilling my success targets.
Ahmed74 · 42 weeks ago
I am for each situation more empowered by the cross variety sort base plans since they are ordinarily expected to cover every single something. Visit homepage for more details. In any case, growing quite a base takes a lot of time.
Ahmed74 · 42 weeks ago
Philadelphia, Pennsylvania’s largest city, is notable for its rich history, on display at the Liberty Bell, Independence Hall (where the Declaration of Independence and Constitution were signed) and other American Revolutionary sites. MaxRemind top rank medical billing company of USA offers medical billing services in Philadelphia, medical credentialing services and home health agency software in Houston.
stevematt · 37 weeks and 5 days ago
The vivified accounts which I am making at last are more visionary and uncommon when showed up undeniably contrasting with the past ones. One hire this changing passive voice to active voice generator to check sentence in work. It is a quick consequence of following your contemplations.
anonymous00 · 37 weeks and 2 days ago
Puzzle Solitaire is the most addictive game I have been proposed by your foundation. Students can visit how to change passive voice to active voice to know about this. I'm playing this game for limitless weeks.
anonymous00 · 37 weeks and 2 days ago
Thank you for this code. This made my work easier.
CarlCuperstone · 26 weeks and 2 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: