Vi Search and Replace Trick

need to know how to search and replace string

Page 1 of 1

1 Replies - 5179 Views - Last Post: 18 October 2006 - 11:19 AM Rate Topic: -----

#1 henok  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 27-September 06

Vi Search and Replace Trick

Posted 18 October 2006 - 10:15 AM

The general Vi trick to search and replace a word is
:%s/old/new/g


But I am trying to search and replace a string with several characters like:

http://home.dreamincode.net with http://forums.dreamincode.net

Vi won't let me just put a // because that is a command by itself.

Help please

Is This A Good Question/Topic? 0
  • +

Replies To: Vi Search and Replace Trick

#2 Nova Dragoon  Icon User is offline

  • The Innocent Shall Suffer, Big Time
  • member icon

Reputation: 36
  • View blog
  • Posts: 6,169
  • Joined: 16-August 01

Re: Vi Search and Replace Trick

Posted 18 October 2006 - 11:19 AM

you will need to escape special characters, by prepending them with a \

like http:\/\/home\.dreamincode\.net
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1