Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Convert date format in BASH

Posted on 2014-02-10
2
Medium Priority
?
1,303 Views
Last Modified: 2014-02-10
Hi,

On RHEL 5.10

I'm looking for a way to convert date format.
for exmple from this: 10-FEB-2014/13:12
to this:                          20140210-1312
0
Comment
Question by:peledc
2 Comments
 
LVL 31

Accepted Solution

by:
farzanj earned 400 total points
ID: 39847248
Try
DATE=$(echo 10-FEB-2014/13:12 | sed 's/[-\/]/ /g')
date -d "$DATE" +"%Y%m%d-%H%M"

Open in new window

0
 
LVL 6

Expert Comment

by:Shiju Jacob
ID: 39847258
date  +"%Y%m%d-%H%M"
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month12 days, 10 hours left to enroll

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question