The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 02-14-2007
mr_bold mr_bold is offline
Registered User
  
 

Join Date: Jan 2007
Location: UB, Mongolia
Posts: 32
String manipulation

Hi all,

Please help me decide this problem. I have a converter application getting its parameters by specified format. Ie: -date2007-02-14

Also I have a files named yyyyMMdd.rar format. So how do I convert the file name to it.
Input:
20070214.rar
Output:
-date2007-02-14

I wrote the following scripts but can't know how to concat them.

Code:
string=20070214.rar
echo $string | cut -c1-4
echo $string | cut -c5-6
echo $string | cut -c7-8

Thank you