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
Search, replace string in file1 with string from (lookup table) file2? gstuart Shell Programming and Scripting 9 06-08-2009 07:11 AM
Perl: Search for string on line then search and replace text Crypto Shell Programming and Scripting 4 01-04-2008 10:24 AM
Search and replace to first occurrence of string gilmord UNIX for Dummies Questions & Answers 7 05-03-2006 08:43 AM
String Search & Replace IwishIknewC UNIX for Dummies Questions & Answers 1 03-25-2006 06:28 AM
string search replace krishna UNIX for Advanced & Expert Users 1 12-19-2001 01:49 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 10-11-2005
whited05 whited05 is offline
Registered User
  
 

Join Date: Jun 2005
Posts: 9
Search and replace string between 2 points

I have a file that contains the following string.

connect odemgr/bank123@odsd

I am liiking to write a scrupt that will change the par of the string between the "/" and the "@" anyhelp qwould be greatly appriciated.
  #2 (permalink)  
Old 10-11-2005
vino's Avatar
vino vino is online now Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,798

Code:
echo "connect odemgr/bank123@odsd" | sed -e 's#\(connect odemgr/\)bank123\(@odsd\)#\1mytext\2#g'

  #3 (permalink)  
Old 10-11-2005
whited05 whited05 is offline
Registered User
  
 

Join Date: Jun 2005
Posts: 9
Quote:
Originally Posted by vino
Code:
echo "connect odemgr/bank123@odsd" | sed -e 's#\(connect odemgr/\)bank123\(@odsd\)#\1mytext\2#g'
The issue here is I will not know what the value of bank123 is.

thanks in advance.
  #4 (permalink)  
Old 10-11-2005
tmarikle tmarikle is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2005
Posts: 683

Code:
echo "connect odemgr/bank123@odsd" | sed -e 's#\(connect odemgr/\).*\(@odsd\)#\1mytext\2#g'

.* will match anything where bank123 is.
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 06:39 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