Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Programming/Scripts

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 29th September 2008, 09:13
unclecameron unclecameron is offline
Senior Member
 
Join Date: Apr 2006
Posts: 115
Thanks: 2
Thanked 8 Times in 7 Posts
Default vi search/replace special characters

I'm trying to search a file and replace all occurrences of

<82>

with

sometext

using

:%/\<82\>/sometext/g

and it's not working, I've also tried

:%s/[<82>]/sometext/g

what am I doing wrong?
Reply With Quote
Sponsored Links
  #2  
Old 29th September 2008, 10:19
burschik burschik is offline
Junior Member
 
Join Date: May 2008
Posts: 24
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Works for me. Are you using some obscure version of vi (rather than vim, for example)?
Reply With Quote
  #3  
Old 29th September 2008, 17:39
unclecameron unclecameron is offline
Senior Member
 
Join Date: Apr 2006
Posts: 115
Thanks: 2
Thanked 8 Times in 7 Posts
Default

I'm using vim-full with alias vi='vim' in my .bashrc
Reply With Quote
  #4  
Old 30th September 2008, 09:42
unclecameron unclecameron is offline
Senior Member
 
Join Date: Apr 2006
Posts: 115
Thanks: 2
Thanked 8 Times in 7 Posts
Default

it looks like the problem is that when I say I want to escape the "<" character I have to use

\<

which is also the pattern match for the beginning of a word in vi, does anyone know how to get around that? I'm also looking at perl options.
Reply With Quote
  #5  
Old 30th September 2008, 09:59
burschik burschik is offline
Junior Member
 
Join Date: May 2008
Posts: 24
Thanks: 0
Thanked 2 Times in 2 Posts
 
Default

I don't think escaping is necessary.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
apache special characters rayit Server Operation 4 30th September 2008 17:01
Help w/ sed parsing special characters clem_c_rock Programming/Scripts 2 6th September 2007 17:35
problem with special characters rayit Installation/Configuration 4 6th September 2007 01:30
Passwords: special characters? which ones? ./w Installation/Configuration 2 2nd June 2007 11:10
Strange characters m u r Installation/Configuration 1 16th March 2006 18:14


All times are GMT +2. The time now is 03:22.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.