[SOLVED] vim search pattern
I have vim on Windows, and need to use it to edit a file containing a list of files. An example would be something like "C:\Documents and Settings\Berticus\foo\bar." I would like to replace "C:\Documents and Settings\Berticus" with something like "D:\Backup\Berticus Files"
If I do something like Code:
:%s/C:\Documents and Settings\Berticus/D:\Backup\Berticus Files Code:
E486: Pattern not found: C:\Documents and Settings\Berticus I also tried: Code:
:%s/*Berticus/D:\Backup\Berticus Files I don't have a lot of experience with patterns, and the semicolon always throughs everything off. I've always found a way to work around it, but this time I can't seem to figure a way around it. ---Edit--- Solved: Code:
:%s/.*Berticus/D:\Backup\Berticus Files |
You need TWO backslashes: C:\\Documents etc.
Backslash is a special character, it's so you can do things like :%s/Indent/\tIndent and it'll insert a tab in front of the word Indent.. |
Quote:
|
Not sure why you still had the issue:
:%s/C:\\Documents and Settings\\Berticus/D:\\Backup\\Berticus Files works for me. But it's good to know you solved it, whatever way |
All times are GMT -5. The time now is 09:50 AM. |