Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Jun 2009 22:48:21 -0500
From:      Lord Of Hyphens <lordofhyphens@gmail.com>
To:        Daniel Underwood <djuatdelta@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Reproduce previous stdout output without running previous command
Message-ID:  <b0442c260906082048u6deeb5a8v44077bf92afc58dc@mail.gmail.com>
In-Reply-To: <b6c05a470906082044l69616b2h531adaa1fdf9f0e@mail.gmail.com>
References:  <b6c05a470906082044l69616b2h531adaa1fdf9f0e@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jun 8, 2009 at 10:44 PM, Daniel Underwood <djuatdelta@gmail.com>wrote:

> OK, this is perhaps a weird question, capable of being very confusing.
>  So let's take a "for instance".
>
> Suppose I run something like the Linux command "fdupes" on a directory
> with many large files.  This operation will take considerable time to
> complete.  When it completes, a lot of output is send to stdout
> (displayed on the terminal).
>
> Further suppose that after running the command, I decide I want to
> save the output to a text file, so I can analyze the results outside
> of the terminal.  What can I do? Well, I can do a traditional
> "copy-and-paste", or I could re-enter the previous command and send it
> to a text file (which I ought to have done in the first place).
>
> But is there another option?  Is there some variable (such as,
> hypothetically, $output[n], where n=some integer index) that I could
> use to store the results in a text file?  Such an option might look
> like the following:
>
> $ fdupes -r ~/directorywithlotsoflargefiles
>
> (.....lots of output, woops, should have sent to a text file!....)
>
> $ output[1] >> ~/textfile.txt
>
> Hopefully this has made (some) sense.
> <freebsd-questions@freebsd.org>


Check the manpage for tee. That should give you a solution you're looking
for.

--Joseph Lenox

-- 
"Nothing unreal exists." - Kiri-kin-tha's First Law of Metaphysics.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?b0442c260906082048u6deeb5a8v44077bf92afc58dc>