how to copy the results from a grep command to the bash clipboard?

Posted by avilella on Super User See other posts from Super User or by avilella
Published on 2011-06-30T14:24:03Z Indexed on 2011/06/30 16:25 UTC
Read the original article Hit count: 189

Filed under:
|
|

If I type something in a Linux bash terminal with no X, and then use Ctrl+u, whatever I typed is stored in the bash "clipboard" (for lack of a better term), and I can type it again doing Ctrl+y.

How can I copy the results from a grep command on a text file to such bash clipboard? For example, if I have an INSTALL file like this:

./installprocedure --do-some-long-and-complicated-operation-on-dir dir1

How can I copy the content of a grep command so that it's available doing Ctrl+y? For example:

copy content to bash clipboard "grep installprocedure INSTALL"  
Ctrl+y  
./installprocedure --do-some-long-and-complicated-operation-on-dir dir1 #cursor available here

© Super User or respective owner

Related posts about bash

Related posts about grep