Solved

solars 10 bash : want to get date like 1/15/14 , i.e. m/dd/yy

Posted on 2014-01-15
3
352 Views
Last Modified: 2014-01-15
hi

I am working on solars 10, and having query on simple bash command,
would like to get date like 1/15/14 , i.e. m/dd/yy , instead of mm/dd/yy

I can simply do like below, but I would like to remove 0 (zero) from month...

bash-3.2$ date "+%m/%d/%y"
01/15/14
bash-3.2$ date "+%D"
01/15/14

can somebody help me on simple scripting or command?
0
Comment
Question by:sleepingluke
3 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 500 total points
ID: 39781986
bash-3.2$ date "+%m/%d/%y" | sed 's/^0//'
bash-3.2$ 1/15/14

bash-3.2$ MDY=$(date "+%m/%d/%y" | sed 's/^0//')
bash-3.2$ echo $MDY
bash-3.2$ 1/15/14

bash-3.2$ MDY=$(date "+%m/%d/%y")
bash-3.2$ echo ${MDY#0}
bash-3.2$ 1/15/14
0
 
LVL 84

Expert Comment

by:ozo
ID: 39782029
If you support GNU libc extension
date "+%-m/%d/%y"
0
 

Author Closing Comment

by:sleepingluke
ID: 39782071
thanks a lot both for support and though let me take this solution this time!
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

760 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

18 Experts available now in Live!

Get 1:1 Help Now