Latest LQ Deal: Linux Power User Bundle
 Home Forums HCL Reviews Tutorials Articles Register Search Today's Posts Mark Forums Read
 LinuxQuestions.org vim search pattern
 User Name Remember Me? Password
 General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices

 08-21-2008, 09:36 AM #1 Berticus Member   Registered: Jul 2005 Distribution: Arch Posts: 159 Rep: [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 It says: Code: E486: Pattern not found: C:\Documents and Settings\Berticus But pretty much every line starts with that. I also tried: Code: :%s/*Berticus/D:\Backup\Berticus Files and that didn't work either. 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 Last edited by Berticus; 08-21-2008 at 10:10 AM. Reason: Fixed
 08-21-2008, 10:26 AM #2 oneandoneis2 Senior Member   Registered: Nov 2003 Location: London, England Distribution: Ubuntu Posts: 1,460 Rep: 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..
08-21-2008, 11:39 AM   #3
Berticus
Member

Registered: Jul 2005
Distribution: Arch
Posts: 159

Original Poster
Rep:
Quote:
 Originally Posted by oneandoneis2 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..
Didn't think it was a special character issue since I was having a similar problem with a different program (in Linux). I used a double backslash to get a backslash character, but I still had the problem.

 08-21-2008, 12:13 PM #4 oneandoneis2 Senior Member   Registered: Nov 2003 Location: London, England Distribution: Ubuntu Posts: 1,460 Rep: 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

 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 Off HTML code is Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post taylor_venable Linux - Software 2 01-31-2007 04:56 PM Akhran Linux - Newbie 4 02-10-2006 12:39 PM naflan Programming 5 01-07-2006 03:16 PM lrt2003 Linux - Newbie 5 05-08-2004 05:21 PM jitz Linux - General 2 12-06-2003 04:50 AM

All times are GMT -5. The time now is 08:08 PM.

 Contact Us - Advertising Info - Rules - LQ Merchandise - Donations - Contributing Member - LQ Sitemap -