Solved

Copy text from a file from VI editor to Windows clipboard

Posted on 2006-07-24
10
3,369 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
Comment Utility
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
Comment Utility
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
Comment Utility
> .. 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
Comment Utility

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
Comment Utility

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

Cheers
JJ
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
> 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
Comment Utility
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
Comment Utility
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
Comment Utility

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
Comment Utility
> .. 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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 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 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…

772 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

12 Experts available now in Live!

Get 1:1 Help Now