<p>I want to use part of the output of a command run from the command line in another xterm, or as part of a different command.  For instance:  </p>

<pre><code>&gt; grep error error.log
error: can't find file ~/&lt;some very long path&gt;/thisfile
</code></pre>

<p>and I want to do this:</p>

<pre><code>&gt;ls ~/&lt;some very long path&gt;/
</code></pre>

<p>I know two ways to do this:<br>
1. copy <code>~/&lt;some very long path&gt;/</code> with the mouse.<br>
2. use some combination of <code>head</code>/<code>tail</code>/<code>awk</code>/<code>sed</code>/<code>perl</code>/<code>cut</code>/etc... to extract only what I need from the output and then use <em>that</em> inside backticks.</p>

<p>Is there any way to copy text without using the mouse?  The example that comes to mind is visual mode inside VIM, but I don't know how to do that inside the xterm.</p>

You can use GNU screen's copy and paste commands.
Quick tutorial:
Open screen:
```
screen
```
(or
```
screen myprog my args here
```
)
Run your program, producing output you want copied
Enter copy mode:
Control
+
a
+
[
Move your cursor to the start point
Hit
Enter
Move your cursor to the end point
Hit
Enter
Paste:
Control
+
a
+
]
Screen is much more powerful than that (I use it to tab several virtual terminals without the need for a special terminal emulator, and also so that I don't loose my sessions when X crashes or something).  To get out of screen, simply end your shell session, or type
Ctrl
+
a
,
Ctrl
+
\
.