The UNIX and Linux Forums  

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
find and replace javeed7 Shell Programming and Scripting 1 04-02-2008 06:00 AM
find and replace rakshit Shell Programming and Scripting 4 01-23-2008 11:52 PM
find and replace mahabunta UNIX for Dummies Questions & Answers 7 09-21-2006 09:05 AM
find and replace valhutch UNIX for Dummies Questions & Answers 4 07-29-2006 02:20 PM
Find & Replace gagansharma Shell Programming and Scripting 3 11-27-2001 12:17 PM

Closed Thread
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-25-2002
Registered User
 

Join Date: Feb 2002
Location: Newark
Posts: 1
Question find and replace

Hi

In our html pages, we have the image path as "/dir1/dir2/image.gif".
We are changing the location of the image directory.
So now we wish to do a global search and replace the path. I think we are having trouble with forward slash character.

Please help

Thanks in advance

Vikas
a newbie
Forum Sponsor
  #2 (permalink)  
Old 02-25-2002
Registered User
 

Join Date: Jan 2002
Posts: 16
If this is all in a single file then go into vi and do the following:

:%s/dir1/dir2/image.gif/<new path>
  #3 (permalink)  
Old 02-25-2002
Registered User
 

Join Date: Jan 2002
Posts: 16
I take that back. This is what you to do:

:%s/\/dir1\/dir2\/image.gif/<new file>
  #4 (permalink)  
Old 02-25-2002
Registered User
 

Join Date: Nov 2001
Location: New Zealand
Posts: 333
If you're going to use vi for this then instead of using a / character for separations...use another character such as =

For example...instead of

:%s/\/dir1\/dir2\/image.gif/<new file>

use:

:%s=/dir1/dir2/image.gif=<new file>

or

:1,$ s=/dir1/dir2/image.gif=<new file>=g

Using the = for the separator will avoid having to specify the backslash to tell the substitution that the / is part of the substitution.



__________________
Pete
Google UNIX.COM
Closed Thread

Thread Tools
Display Modes




All times are GMT -7. The time now is 09:16 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0