Solved

Copy text from a file from VI editor to Windows clipboard

Posted on 2006-07-24
10
3,375 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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:Kdo
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:
Kdo 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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.

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now