Re: Reproduce previous stdout output without running previous command

2009-06-10 Thread Frank Shute
On Mon, Jun 08, 2009 at 11:13:00PM -0700, Norbert Papke wrote:

 On June 8, 2009, Daniel Underwood wrote:
  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:
 
 You could use sysutils/screen from ports.  Screen lets you capture your 
 session in a log file.  If you decide you need the output from a previous 
 command, it would be trivial to extract from the log.
 

Nobody's mentioned script(1).


Regards,

-- 

 Frank 


 Contact info: http://www.shute.org.uk/misc/contact.html 

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Reproduce previous stdout output without running previous command

2009-06-09 Thread Norbert Papke
On June 8, 2009, Daniel Underwood wrote:
 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:

You could use sysutils/screen from ports.  Screen lets you capture your 
session in a log file.  If you decide you need the output from a previous 
command, it would be trivial to extract from the log.

-- Norbert Papke.
   npa...@acm.org


http://saveournet.ca
Protecting your Internet's level playing field
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Reproduce previous stdout output without running previous command

2009-06-08 Thread Lord Of Hyphens
On Mon, Jun 8, 2009 at 10:44 PM, Daniel Underwood djuatde...@gmail.comwrote:

 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.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Reproduce previous stdout output without running previous command

2009-06-08 Thread Steven Schlansker


On Jun 8, 2009, at 8:48 PM, Lord Of Hyphens wrote:

On Mon, Jun 8, 2009 at 10:44 PM, Daniel Underwood djuatde...@gmail.com 
wrote:


$ 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.


I think the intention of the original question was for the case where  
you have
forgotten to set up a pipe/redirection properly before starting the  
long-
running command.  Tee would work fine if you have the foresight to use  
it...


Steven
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Reproduce previous stdout output without running previous command

2009-06-08 Thread Dan Nelson
In the last episode (Jun 08), Steven Schlansker said:
 On Jun 8, 2009, at 8:48 PM, Lord Of Hyphens wrote:
  On Mon, Jun 8, 2009 at 10:44 PM, Daniel Underwood djuatde...@gmail.com 
  wrote:
 
  $ fdupes -r ~/directorywithlotsoflargefiles
 
  (.lots of output, woops, should have sent to a text file!)
 
  $ output[1]  ~/textfile.txt
 
  Check the manpage for tee. That should give you a solution you're
  looking for.
 
 I think the intention of the original question was for the case where you
 have forgotten to set up a pipe/redirection properly before starting the
 long- running command.  Tee would work fine if you have the foresight to
 use it...

How much output are you expecting to capture?  You can configure an
arbitrary number of syscons history lines or screen scrollback lines.  I'm
sure xterm can be configured similarly, but I can't find it from a quick
skim of the manpage.  I have syscons set to 1024 lines and screen set to
10240 lines myself.  You can use vidcontrol -HP to dump syscons history if
you need to copy more than you can select with the mouse on a single page,
and screen has a whole sub-interface for interacting with its scrollback.

-- 
Dan Nelson
dnel...@allantgroup.com
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Reproduce previous stdout output without running previous command

2009-06-08 Thread LoH

Daniel Underwood wrote:

I read up on tee, but I'm not sure it does the trick.  From what I
understand, tee simply enters a mode where what you type gets put into
a text file.
  
What actually happens is when you pipe it to tee, it shows up in a text 
file and on the screen. That lets you make the quick decision of whether 
or not to keep the file you just made.


--Joseph Lenox

PS: Please remember to CC to the mailing list.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org