Solved

Copy text from a file from VI editor to Windows clipboard

Posted on 2006-07-24
10
3,379 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

829 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