Solved

Convert date format in BASH

Posted on 2014-02-10
2
970 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
Comment Utility
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
Comment Utility
date  +"%Y%m%d-%H%M"
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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.:

743 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now