Solved

Search and Replace in Vi Editor

Posted on 2007-11-18
4
8,350 Views
Last Modified: 2013-12-16
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
Comment
Question by:Simon336697
4 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 440 total points
ID: 20310246
1,$s#MindMaps#Algorithms/002/text
0
 
LVL 6

Assisted Solution

by:Arthur_Mino
Arthur_Mino earned 30 total points
ID: 20310299
G'day,

I think you'll need the grep command here

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

Cheers,
Arthur
0
 
LVL 3

Assisted Solution

by:amirs80
amirs80 earned 30 total points
ID: 20310388
:%s$MindMaps$Algorithms/002/text
there are many other tech , by using sed is also is a tech
0
 
LVL 1

Author Comment

by:Simon336697
ID: 20310624
Guys thanks for that :>)

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

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Squid Connection Pools 3 68
linux pull logs and export FTP 4 71
awk to variable in bash 2 42
Quickest way to query Windows Event ID from a Linux Device 3 31
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question