1819802 Members
3163 Online
109607 Solutions
New Discussion юеВ

vi editor

 
Raju_S
Frequent Advisor

vi editor

Hi,

I need to copy the contents of vi and paste in word. Want to know the command to copy the whole contents in vi editor.

Regards
7 REPLIES 7
spex
Honored Contributor

Re: vi editor

Hi,

You have to use your terminal emulator's built-in copy, rather than vi's "yank". If you're using PuTTY, simply highlight the desired text, and paste (ctrl+V) into Word. Other emulators may require a copy (ctrl+C) step after highlighting the text.

PCS
Pete Randall
Outstanding Contributor

Re: vi editor

yG will copy the whole contents of the file, but I'm not sure how you are going to paste a vi editor buffer into word.


Pete

Pete
Coolmar
Esteemed Contributor

Re: vi editor

I assume you are using Windows if you want to copy it to word. Therefore, cat the file and highlight it all and press CTRL+C and then CTRL+V within word. Or, you can ftp the file to your windows and then just open it within word as I assume it will just be a text file.
Steve Post
Trusted Contributor

Re: vi editor

It's not a vi command you are looking for. It is the copy/paste command in X. Where X is the terminal emulator you are using.
If you are on windows, you can probably just use cut and paste with the MOUSE.

If X is some amber terminal sitting in a computer room? I don't care how long your mouse can reach. It can't walk to other rooms.

So what do you do? You need to grab copy the file to your pc via ftp.
But first you might want to run the ux2dos command to make it more readable.

1. cat myunixfile | un2dos > myunixfile.txt
(Note I added .txt to the end).
2. ftp file myunixfile.txt to your pc
c:\myunixfile.txt
3. open msword
4. open c:\myunixfile.txt

steve
Yogeeraj_1
Honored Contributor

Re: vi editor

hi,

if you mean to import the text into a microsoft word document then it is preferable that you ftp the file to the windows environment first.

you can then open the file using either notepad and use copy+paste commands to put it in a word document.


kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Raj D.
Honored Contributor

Re: vi editor

Hi Ramnath,

If you want to copy the entire content of the file , its very simple:

"Want to know the command to copy the whole contents in vi editor."

Suppose you have a big file , then vi will not show the entire file , it will show only 40 lines in the screen , so even if you select all the line from your mouse you cannot paste it in the word file.

Here is some senario to get the file:

1. ftp the file with ascii format to local pc:
2. From you putty session you can get the entire file:

- In Puty --> right click --> Change Settings --> Logging --> choose "Log all Session output" --> provide a filename .

- do a $ cat file_name_to_paste

- close the session.

- Check the file. All the entire content will be there in that file.


Cheers,
Raj.
" If u think u can , If u think u cannot , - You are always Right . "
Raju_S
Frequent Advisor

Re: vi editor

Thankyou all for your suggestion. I ftp'ed the file and opened in word.

Regards
Ramnath S