Discussion Locked

Vi Editor!

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have to add a similar word to all the lines of a file in VI editor. The document contains more that 2000 lines. Please tell me is there any script or commnad available to do so.

Thanks

Anwar

5 replies

by emcs

The following global command, in vi, works for me:

Open the file in vi:

for example

anwar
ahmed
khan
naeem

do the following

:g;.;s;.;/home/&;

the results

/home/anwar
/home/ahmed
/home/khan
/home/naeemI used this command with a file that had 5000 records. Let me know how you do.

dennie

by anwar®

Thanks a lot! It really works and help me.
I want to learn Vi Editor would you please guide me regarding the available resources for that.

Thank you very much.

Anwar

by gunjandavid1

there is a vi editor operator by which you can write a thousand of similar words in a single line......

like..... 20igunjan ( in open file i.e vi gunjan)

it write a 20 words of gunjan in single line .....now i think ur problem'll be solve....if not den plzzzzzzzz rply me.......

This discussion is closed to new replies.