![]() |
|
|
|
|
|||||||
| 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 |
| substring | panknil | Shell Programming and Scripting | 4 | 10-01-2007 05:12 AM |
| How do I Substring ?? | Rigger | Shell Programming and Scripting | 6 | 04-25-2007 11:26 PM |
| substring | alla.kishore | UNIX for Dummies Questions & Answers | 8 | 01-08-2007 11:57 PM |
| Getting a substring | djkane | Shell Programming and Scripting | 3 | 03-21-2006 06:50 AM |
| substring | Anika | UNIX for Dummies Questions & Answers | 4 | 09-19-2001 12:10 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
I'm working in:
#!/bin/ksh My question: I have a variable latest_bus_date, which in in the format YYYYMMDD. I would like to create a new variable that is in the format of MMDDYY using the data stored in latest_bus_date. $latest_bus_date='20020304' The new variable should have: 030402 Any ideas? Thanks, blt123 |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
This is done in /bin/ksh on Dynix/ptx 4.4.8:
This isn't the prettiest command ever, but it works from what I can tell... new_date="`echo $latest_bus_date |cut -c5-6``echo $latest_bus_date |cut -c7-8``echo $latest_bus_date | cut -c3-4`" echo $new_date |
|
#3
|
|||
|
|||
|
Thank you - it works!
|
|||
| Google The UNIX and Linux Forums |