Solved

Convert date format in BASH

Posted on 2014-02-10
2
1,036 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 100 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

831 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