General discussion

Locked

Vi Editor!

By Anwar? ·
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

This conversation is currently closed to new comments.

4 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Vi Editor!

by emcs In reply to Vi Editor!

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

Collapse -

Vi Editor!

by Anwar? In reply to Vi Editor!

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

Collapse -

Reponse To Answer

by gunjandavid1 In reply to Vi Editor!

i cudn't got it ....what u wanna to say......????

Collapse -

Vi Editor!

by Anwar? In reply to Vi Editor!

This question was closed by the author

Back to Linux Forum
4 total posts (Page 1 of 1)  

Operating Systems Forums