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 > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
sed string manipulation speedieB Shell Programming and Scripting 4 11-23-2008 08:27 PM
string manipulation james6 UNIX for Dummies Questions & Answers 5 06-03-2008 10:05 AM
string manipulation Cactus Jack Shell Programming and Scripting 9 02-14-2008 01:14 PM
string manipulation hai1973 Shell Programming and Scripting 13 08-20-2007 11:27 AM
awk string manipulation zoo591 Shell Programming and Scripting 2 08-09-2006 12:13 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #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
  #2 (permalink)  
Old 02-14-2007
anbu23 anbu23 is offline Forum Advisor  
Registered User
  
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,398
Code:
echo 20070214.rar | sed "s/\([0-9]\{4\}\)\([0-9]\{2\}\)\([0-9]\{2\}\).*/-Date\1-\2-\3/"
  #3 (permalink)  
Old 02-14-2007
mr_bold mr_bold is offline
Registered User
  
 

Join Date: Jan 2007
Location: UB, Mongolia
Posts: 32
Thumbs up

Thank you very much.
I will study these kinds of string manipulation.
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 10:14 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
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