bash: any way to reuse the last output?

John Kodis kodis at mail630.gsfc.nasa.gov
Fri Jan 23 16:48:24 UTC 2004


On Fri, Jan 23, 2004 at 03:20:17AM -0200, Herculano de Lima Einloft Neto wrote:

>    This happens all the time: after an intricate find, I decide
> to grep something out of that very same find, for instance. It
> would be nice to have some tweak to reuse the last output without
> having to run the command again. Anyone?

If you're only dealing with a partial screenful of data, you could cut
and paste it into a "here" document:

    $ grep foo <<EOF
    > { paste stuff to be grepped here }
    > EOF

If you have too much data to paste into a here document, I'm afraid
that you're out of luck.  I doubt that bash saves the output anywhere
due to the performance hit and the need to deal with both stdout and
stderr seperately.  It sure would be a handy thing to have on the few
occasions when you need it though.

-- 
John Kodis                                    Goddard Space Flight Center
kodis at mail630.gsfc.nasa.gov                      Greenbelt, Maryland, USA
Phone: 301-286-7376                                     Fax: 301-286-1771





More information about the fedora-list mailing list