LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 02-16-2012, 03:33 AM   #1
rajini23
Member
 
Registered: Sep 2011
Posts: 162

Rep: Reputation: Disabled
Unhappy Problem in replacing string in vi editor


Hi,

I tried to replace a windows directory structure to http path structure in vi editor but it's giving me error "E488 trailing characters...

I use redhat 5.0
in vi Editor i wants to replace the string from ...

C:\Users\v-linuxsupportblr\Desktop\New\DataBase\ TO
http://180.190.35.6/


please help me on this
 
Old 02-16-2012, 05:53 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

You need 2 things to make this work:
- use a different, unique seperator (^ instead of /). This way you don't have to escape the forward slashes in the replace string.
- you need to escape all the back slashes in the search string, they are special.

Code:
:%s^C:\\Users\\v-linuxsupportblr\\Desktop\\New\\DataBase\\^http://180.190.35.6/^
Hope this helps.

Last edited by druuna; 02-16-2012 at 06:33 AM. Reason: fixed a typo: ttp -> http
 
Old 02-16-2012, 06:26 AM   #3
rajini23
Member
 
Registered: Sep 2011
Posts: 162

Original Poster
Rep: Reputation: Disabled
Smile

Thank you so much it worked......
 
Old 02-16-2012, 06:33 AM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
You're welcome
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
c++ : replacing a char in a string cb951303 Programming 20 02-25-2015 08:18 PM
problem in replacing string in vi editor texasj Linux - Newbie 8 07-26-2011 01:01 AM
Replacing string using awk gregarion Programming 3 01-19-2010 11:02 PM
Replacing certain parts of a string dipuasks Linux - Server 5 11-22-2008 07:09 AM
replacing string within same file tostay2003 Programming 2 07-06-2007 02:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration