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 and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
help on sed replacing special characters prvnrk Shell Programming and Scripting 11 10-01-2008 12:02 PM
replacing characters infyanurag Shell Programming and Scripting 3 05-21-2008 02:55 AM
Replacing characters in csv file finwhiz UNIX for Dummies Questions & Answers 1 03-31-2008 06:25 AM
replacing characters palmer18 UNIX for Dummies Questions & Answers 3 08-20-2007 10:58 AM
replacing certain characters with new line? Bashar Shell Programming and Scripting 4 05-13-2007 05:34 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-26-2005
prekida prekida is offline
Registered User
  
 

Join Date: Jul 2005
Posts: 7
Replacing set of characters with a value of a variable

I need to replace anything immediately after the pattern "standard01/" in a file with the value of a variable
I don't know the length of the characters stored in that variable. - that might vary.
I know there is some string after the pattern "standard01/", i don't know the what the string is or the length of it. but i know after that string following "standard01/", there is blank space and after that a word called "buf" in that file

So, the string following the pattern "standard01/" for example looks like
"special_previlege_datetime.lst" followed by a space and then a string begins with "buf" - when in the process of replacing the value of the variable right after the above pattern "standard01/" - i should not start overwriting the next string "buf"
- in other words i should try to replace/write the value of the variable starting
immediately after "standard01/" and before the next word "buf" begins.

Please provide your advice.
Your help is greatly apprecitaed.
Thanks
  #2 (permalink)  
Old 07-26-2005
fdarkangel's Avatar
fdarkangel fdarkangel is offline
Registered User
  
 

Join Date: Apr 2005
Location: /dev/null
Posts: 42
a way is: sed -i 's/standard01\/ .* buf/standard01\/ NUMBER buf/g' file.in
if you guarantee that all characters between the standard01/ and buf are digits, you can use: sed -i 's/standard01\/ [0-9]* buf/standard01\/ NUMBER buf/g' file.in
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 03:07 PM.


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