The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Date Format biju.mp UNIX for Dummies Questions & Answers 2 12-31-2007 09:56 AM
date issue-find prevoius date in a patricular format bsandeep_80 UNIX for Advanced & Expert Users 3 11-15-2007 08:42 PM
Date format Knotty UNIX for Dummies Questions & Answers 2 04-11-2007 01:48 PM
convert mmddyy date format to ccyyddd format?? Bhups Shell Programming and Scripting 2 09-27-2006 11:30 PM
date format big123456 Shell Programming and Scripting 2 07-22-2005 04:57 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-25-2008
ali560045's Avatar
ali560045 ali560045 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 328
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
  #2 (permalink)  
Old 01-25-2008
anchal_khare anchal_khare is offline
Registered User
  
 

Join Date: Jun 2007
Location: Mumbai,India
Posts: 321
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 (permalink)  
Old 01-25-2008
panknil panknil is offline
Registered User
  
 

Join Date: Apr 2007
Location: Kolkata
Posts: 82
Thumbs up date format

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 (permalink)  
Old 01-25-2008
V3l0 V3l0 is offline
Registered User
  
 

Join Date: Nov 2007
Location: Belgium & France
Posts: 70
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
Result:
Code:
date1=28JAN2008
date2=28Jan2008
Hope it'll help
  #5 (permalink)  
Old 01-25-2008
fpmurphy's Avatar
fpmurphy fpmurphy is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2003
Location: Florida
Posts: 1,861
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/
'
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 11:04 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0