Unix Programming - unix riddle

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > February 2005 > unix riddle





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author unix riddle
puzzlecracker

2005-02-21, 6:00 pm

Say that when you run the Unix command junky in your shell, it spits
out a ton of text to the console, too much for your console buffer to
hold. How would you run it so that you can look at everything it
outputs after it finishes?

Lew Pitcher

2005-02-21, 6:00 pm

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

puzzlecracker wrote:
> Say that when you run the Unix command junky in your shell, it spits
> out a ton of text to the console, too much for your console buffer to
> hold. How would you run it so that you can look at everything it
> outputs after it finishes?
>

junky >~/junky.stdout # run junky, send output to file
more ~/junky.stdout # junky done, read output from file

- --
Lew Pitcher
IT Specialist, Enterprise Data Systems,
Enterprise Technology Solutions, TD Bank Financial Group

(Opinions expressed are my own, not my employers')
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)

iD8DBQFCGkx9agVFX4UWr64RAsq9AJsG5pQ2KIbK
523P9WLEHJOBem1EMACcDuIb
QqC4vUmFzZNMy7BlIZqJ7Sw=
=Ddc6
-----END PGP SIGNATURE-----
Dragan Cvetkovic

2005-02-21, 6:00 pm

Lew Pitcher <Lew.Pitcher@td.com> writes:

> puzzlecracker wrote:
> junky >~/junky.stdout # run junky, send output to file
> more ~/junky.stdout # junky done, read output from file


And hope that nothing gets been written to stderr?

Dragan

--
Dragan Cvetkovic,

To be or not to be is true. G. Boole No it isn't. L. E. J. Brouwer

!!! Sender/From address is bogus. Use reply-to one !!!
puzzlecracker

2005-02-21, 6:00 pm


Dragan Cvetkovic wrote:
> Lew Pitcher <Lew.Pitcher@td.com> writes:
>
spits[vbcol=seagreen]
to[vbcol=seagreen]
>
> And hope that nothing gets been written to stderr?
>
> Dragan
>
> --
> Dragan Cvetkovic,
>
> To be or not to be is true. G. Boole No it isn't. L. E. J.

Brouwer
>
> !!! Sender/From address is bogus. Use reply-to one !!!


no worries about stderrr

Mark Rafn

2005-02-21, 6:00 pm

puzzlecracker <ironsel2000@gmail.com> wrote:
>Say that when you run the Unix command junky in your shell, it spits
>out a ton of text to the console, too much for your console buffer to
>hold. How would you run it so that you can look at everything it
>outputs after it finishes?


If you get a large, high-resolution monitor, you can set the text size REALLY
small, and still be able to read it. You should be able to get three or four
times the amount of information you used to.

Better yet, use a real teletype, as Unix was designed. As long as
you don't run out of paper, you can scroll back as far as you want.

Alternately, you can use the power of Unix to answer such riddles - pipelines
of many commands can make life very easy.
junky | cat | rev | more | rev | cat | less
is likely to do the trick. There may be more efficient ways, but they take
less typing.

p.s. you might try comp.unix.questions rather than comp.unix.programmer. This
isn't really a programming question.
--
Mark Rafn dagon@dagon.net <http://www.dagon.net/>
"America is at that awkward stage. It's too late to work within the system,
but too early to shoot the bastards." -- Claire Wolfe
Russell Shaw

2005-02-21, 8:50 pm

puzzlecracker wrote:
> Say that when you run the Unix command junky in your shell, it spits
> out a ton of text to the console, too much for your console buffer to
> hold. How would you run it so that you can look at everything it
> outputs after it finishes?


I just press Shift-PageUp and the screen scrolls to previous output as
far as i want.
Arjun Thounaojam

2005-02-22, 7:59 am

I would use "script":

script /tmp/junky.output #save console output to junky.output
junky #run junky
exit #exit script

less /tmp/junky.output #read junky.output

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com