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
find and replace javeed7 Shell Programming and Scripting 1 04-02-2008 09:00 AM
find and replace rakshit Shell Programming and Scripting 4 01-24-2008 03:52 AM
find and replace mahabunta UNIX for Dummies Questions & Answers 7 09-21-2006 12:05 PM
find and replace valhutch UNIX for Dummies Questions & Answers 4 07-29-2006 05:20 PM
Find & Replace gagansharma Shell Programming and Scripting 3 11-27-2001 04:17 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-25-2002
vikas_j@hotmail vikas_j@hotmail is offline
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
  #2 (permalink)  
Old 02-25-2002
Atama Atama is offline
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
Atama Atama is offline
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
peter.herlihy peter.herlihy is offline
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.



Sponsored Links
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 04:44 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