Solved

Copy text from a file from VI editor to Windows clipboard

Posted on 2006-07-24
10
3,391 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: 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

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

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
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…
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…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

728 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