The UNIX and Linux Forums  

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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
string manipulation Cactus Jack Shell Programming and Scripting 9 02-14-2008 10:14 AM
awk manipulation Nicol Shell Programming and Scripting 2 07-05-2006 12:51 AM
More log manipulation StevePace Shell Programming and Scripting 8 02-13-2006 12:20 AM
Help with log manipulation StevePace Shell Programming and Scripting 3 01-31-2006 05:28 PM
manipulation vivekshankar UNIX for Dummies Questions & Answers 13 05-19-2005 12:45 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 02-27-2002
Registered User
 

Join Date: Feb 2002
Posts: 18
Thumbs up variable manipulation

Coded in my script:
#!/bin/ksh

I have a variable in the format of YYYYMMDD: $latest_bus_date_yyyymmdd
I need to create a new variable in the format of MMDDYYYY: $latest_bus_date_mmddyyyy
I want to take the information from $latest_bus_date_yyyymmdd and reformat it to be stored in the new variable.

Any ideas on how to do this?

Thanks for any suggestions!

Last edited by blt123; 03-04-2002 at 11:17 AM.
Reply With Quote
Forum Sponsor
  #2  
Old 02-27-2002
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,667
I can't exactly parse your question, but I think this is what you want:
x=20020227
y=${x#????}${x%????}
echo $y
Reply With Quote
  #3  
Old 02-27-2002
Registered User
 

Join Date: Feb 2002
Posts: 18
Wink variable manipulation

Thank you - it worked!
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 07:28 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0