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

Inserting text using vi

Reply to Message Icon

Original Message
Name: Richard
Date: September 14, 2001 at 14:10:31 Pacific
Subject: Inserting text using vi
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


Report Offensive Message For Removal


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

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.


Report Offensive Follow Up For Removal

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

why use vi when you can use pico?

i consider pico to be a better editor than vi


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Inserting text using vi

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes In 5 Days.
Discuss in The Lounge