English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

in VI Editor, how do I do a replace command for a Windows Path? The following does not work:

:%s/STAGING/WORKPATH\wa/g

I'm trying to replace the Word STAGING with WORKPATH\wa.

When I run the above command, the following is the result on the doc.

Result= WORKPATHwa

The "\" does not show up.

Any idea on how I can accomplish this?

2006-09-24 14:55:31 · 2 answers · asked by DLEETM 1 in Computers & Internet Programming & Design

2 answers

I don't use vi if emacs or GTK programs are there, so can't help, but there is a replace command line utility from MySQL, its helpfile says that this replace command is internally developed for MySQL but useful in general purpose bla bla... it uses a simple reg-ex like matching system with a fixed setting of /g

But you forgot to escape the "\" with "\\"..

2006-09-24 15:06:11 · answer #1 · answered by Andy T 7 · 1 0

The earlier answer by Andy is correct. You need to "escape" the backslash with another backslash.

The backslash is a special character for many Unix text editors, starting with ex and sed on up to vi. If you want to use the literal backslash character (or any other special character, for that matter), you need to put a backslash in front of it.

I hope that this helps!

2006-09-25 00:14:59 · answer #2 · answered by codewriterdavid 3 · 0 0

fedest.com, questions and answers