Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

search/replace URL 1

Status
Not open for further replies.

ksbrace

Programmer
May 13, 2000
501
US
Hello,
I'm attempting to do a global search and replace within vi. The replacement string is a url, so I'm getting "trailing character" error message.


searching for: !File_Path_to_Replace!

replacing with: /usr/local/twiki

Here's my command:
Code:
:%s/!File_Path_to_Replace!//usr/local/twiki/g

Thanks in advance!

 
Try the following:

s?!File_Path_to_Replace!?/usr/local/twiki?g

I hope that helps.

Mike
 
The reason the ?-delimited replace command does work, and the /-delimited command doesn't, is because you cannot use unquoted delimiter chars in your search and replace strings.

This would work also:

Code:
:%s/!File_Path_to_Replace!/\/usr\/local\/twiki/g


HTH,

p5wizard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top