Solved

Copy text from a file from VI editor to Windows clipboard

Posted on 2006-07-24
10
3,384 Views
Last Modified: 2007-11-27
I'm running Windows, but I connect to a linux server through a shell client. I want to do a quick copy and paste of the entire text of a file in vi from the client into a windows app. Is there a command for this?
0
Comment
Question by:polkadot
  • 3
  • 2
  • 2
  • +3
10 Comments
 
LVL 48

Expert Comment

by:Tintin
ID: 17173056
How big is the file?  
What telnet/ssh client are you using?

You'd be better off simply transfering the file if the contents are too big for copy/paste.
0
 
LVL 38

Expert Comment

by:yuzh
ID: 17181169
you can FTP the file to the to the Windows PC, otherwise, you can type to write a
VB script to do the copy and paste. For VB script, it is better to post the question
in the VB TA.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 17187435
> .. but I connect to a linux ..
assuming you connect using ssh (from command line):

  ssh user@remote cat file >localfile
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Expert Comment

by:JJSmith
ID: 17188655

Need to confirm your interpretation of a shell client.

Are you using something like telnet/teemtalk/X-windows to connect to the UNIX server?

The answer is not quite academic - but terminal emulators offer 'cut and paste', one screen at a time. Secure shell (SSH), as indicated by ahoffmann allow the execution of a remote command ( in this case cat ), with the results being send to the local file store '> localfile' - a rather nifty secure way of transfering data!!

Clarification of your access method would be required for a precise answer to your question.

Cheers
JJ
0
 
LVL 6

Expert Comment

by:JJSmith
ID: 17188664

I forgot to mention - none of us will hold it against you for 'running windows' ;-)

Cheers
JJ
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 17190296
> a rather nifty secure way of transfering data!!
hmm, I'd say a rather quirky way to do a scp ;-)
0
 
LVL 45

Expert Comment

by:Kent Olsen
ID: 17204612
Hi JJSmith,

> I forgot to mention - none of us will hold it against you for 'running windows' ;-)

In a mighty forgiving mood today, huh?  :~}

Kent
0
 

Author Comment

by:polkadot
ID: 17243123
I'm using SSH Secure Shell non-commercial version which does not include PKI and PKCS#11 functionality ... downloaded it from ssh.com...


Anyway, I know I can copy a screen a time throug the terminal, and I know I can transfer files, but is there a  vi command that will allow me to copy and past large block of text in a file when I have it opened in vi? If you've answered this I'm sorry I couldn't seem to find the burried answers above.
0
 
LVL 45

Accepted Solution

by:
Kent Olsen earned 500 total points
ID: 17243312

Hi Polkadot,

The short answer is "no", you can't copy from vi and paste via windows.  The VI buffers are separate from the Windows clipboard(s).

But there are things that you can do.  If you have access to the X environment you can run one of the X-based editors which does support cut-and-paste as you're accustomed to.  A Windows X-Terminal (such as Hummingbird) will then be able to copy/cut text which you can then paste into notepaid, wordpad, etc.

You might find it easier to just transfer the files.  FileZilla is a pretty darned good tool.  ssh protocol, gui front end, etc.


Kent
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 17396037
> .. is there a  vi command that will allow me to copy and past large block of text in a file when I have it opened in vi? ..

42Y
p

copies 42 to lines starting at current position and pastes it right after the current line

man vi
4 weaks try&error could save 42 minutes reading ;-)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question