Computing.Net > Forums > Unix > Inserting text using vi

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Inserting text using vi

Reply to Message Icon

Name: Richard
Date: September 14, 2001 at 14:10:31 Pacific
Comment:

Hello people!
Can anybody please tell me how you can globally insert words into a text file using vi??
I need to be able to insert the words 'echo dummy' between 2 words on many lines of a text file.
Any help would be very much appreciated.
Thanks



Sponsored Link
Ads by Google

Response Number 1
Name: tom z.
Date: September 15, 2001 at 12:21:36 Pacific
Reply:

First, be sure to make a copy of the file, then:

vi filename

This is a sed input to while in vi:

:1,$/first second/first new second/g

That should do it, be sure to save the change afterwards.

Hope this helps, good luck.


0

Response Number 2
Name: acidchaoz
Date: September 18, 2001 at 13:51:45 Pacific
Reply:

why use vi when you can use pico?

i consider pico to be a better editor than vi


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Inserting text using vi

insert text in file using scripts www.computing.net/answers/unix/insert-text-in-file-using-scripts/7044.html

Selecting large text on VI www.computing.net/answers/unix/selecting-large-text-on-vi/7505.html

How to delete ^M character using vi www.computing.net/answers/unix/how-to-delete-m-character-using-vi/2451.html