Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 8441
  • Last Modified:

Search and Replace in Vi Editor

Hi guys hope you can help me :>)

I have a question on using VI Editor.

I often want to do search and replacements in a text file, and use VI to do this.

For example,

:1,$s/MindMaps/Algorithms

What the above does is to find all instances of MindMaps, and replace it with Algorithms.

What Im having trouble with is the following...

:1,$s/MindMaps/Algorithms/002/text

In the above, I want to replace the word

MindMaps

with

Algorithms/002/text

What I get is an error in VI Editor saying "Trailing characters"

Q. How do I do a replacement in Vi with forward slashes included in the replacement?

Thank you.
0
Simon336697
Asked:
Simon336697
3 Solutions
 
ozoCommented:
1,$s#MindMaps#Algorithms/002/text
0
 
Arthur_MinoCommented:
G'day,

I think you'll need the grep command here

Check this link out
http://lowfatlinux.com/linux-sed.html

Cheers,
Arthur
0
 
amirs80Commented:
:%s$MindMaps$Algorithms/002/text
there are many other tech , by using sed is also is a tech
0
 
Simon336697Author Commented:
Guys thanks for that :>)

ozo...that was exactly what i was looking for.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now