![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Date Format | biju.mp | UNIX for Dummies Questions & Answers | 2 | 12-31-2007 06:56 AM |
| date issue-find prevoius date in a patricular format | bsandeep_80 | UNIX for Advanced & Expert Users | 3 | 11-15-2007 05:42 PM |
| Date format | Knotty | UNIX for Dummies Questions & Answers | 2 | 04-11-2007 10:48 AM |
| convert mmddyy date format to ccyyddd format?? | Bhups | Shell Programming and Scripting | 2 | 09-27-2006 08:30 PM |
| date format | big123456 | Shell Programming and Scripting | 2 | 07-22-2005 01:57 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||
|
||||
|
date format
i have a date format like this for example
24JAN2008 a=`date+"%d%b%Y"`--------this gives me date format 24Jan2008. i want Jan and not JAN and likewise...this is just an example.....likewise there are so many months in caps ....... help me in this |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
date | tr "[:upper:]" "[:lower:]" will give all the value in lowercase.
for ur case... echo 24JAN2008 | tr "[:upper:]" "[:lower:]" will gice the output as 24jan2008 |
|
#3
|
|||
|
|||
|
Dear ali560045,
if you dont mind can you please explain ur problem little bit clearely? it will be easier to give you a proper solution. Thanks, Regards, Pankaj |
|
#4
|
|||
|
|||
|
Code:
date1=28JAN2008 date2=$(echo $date1 | sed 's/'$(echo $date1 | cut -c4-5)'/'$(echo $date1 | cut -c4-5 | tr '[:upper:]' '[:lower:]')'/') echo date1=$date1 echo date2=$date2 Code:
date1=28JAN2008 date2=28Jan2008 |
|
#5
|
|||
|
|||
|
Using sed
Code:
echo $date | sed '
h
s/[0-9]\{1,2\}.\(..\).*/\1/
y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
G
s/\(.*\)\n\([0-9]\{1,2\}.\)\(..\)\(.*\)/\2\1\4/
'
|
|||
| Google The UNIX and Linux Forums |