Solved

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

Posted on 2014-01-15
3
356 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to improve IO of Solaris machine 15 83
retrieve nuemaric value from txt file in shell script 3 61
Searching File Names and Eliminating Duplicates in Linux 4 64
Access_log 17 100
Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
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…
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.:

895 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