Unix Shell - Collecting output from screen

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > January 2006 > Collecting output from screen





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 Collecting output from screen
user

2006-01-29, 9:30 pm

Hi.. I have a shell / scripting question for you gurus..

If I have to unzip multiple files (say 50) (and each of these files
contain about 1000 or so files, so all the output can't be seen)
how do I collect the output from the screen, so that for example, if one
of the files is corrupted, then I can see that in a log, and then try to
download it again ?

Thanks


Benjamin Schieder

2006-01-29, 9:30 pm

user wrote:
> Hi.. I have a shell / scripting question for you gurus..
>
> If I have to unzip multiple files (say 50) (and each of these files
> contain about 1000 or so files, so all the output can't be seen)
> how do I collect the output from the screen, so that for example, if one
> of the files is corrupted, then I can see that in a log, and then try to
> download it again ?


You want to use redirection:
unzip file.zip 2>&1 >unzip.logfile

Greetings,
Benjamin

--
Benjamin 'blindCoder' Schieder
Registered Linux User #289529: http://counter.li.org
finger blindcoder@scavenger.homeip.net | gpg --import
--
/lusr/bin/brain: received signal: SIGIDIOT
Stephane Chazelas

2006-01-29, 9:30 pm

On Wed, 25 Jan 2006 12:26:42 -0500, user wrote:
> Hi.. I have a shell / scripting question for you gurus..
>
> If I have to unzip multiple files (say 50) (and each of these files
> contain about 1000 or so files, so all the output can't be seen)
> how do I collect the output from the screen, so that for example, if one
> of the files is corrupted, then I can see that in a log, and then try to
> download it again ?

[...]

man script

or:

unzip ... | tee file.log

or:

unzip ... | more

(replace "more" with your favourite pager).

--
Stephane
Tonagon

2006-01-29, 9:31 pm

Crud the answer is already here, I am too slow.
Wait, I've got it!
Take very fast pcitures of the screen with a polaroid or digital
camera!
Ha! Bet nobody else thought of that little gem.


Eric van der Meer

2006-01-29, 9:31 pm

In article <43d7baea$0$20777$9b4e6d93@newsread4.arcor-online.net>,
Benjamin Schieder <blindcoder@scavenger.homeip.net> wrote:

> user wrote:
>
> You want to use redirection:
> unzip file.zip 2>&1 >unzip.logfile
>
> Greetings,
> Benjamin
>
> --
> Benjamin 'blindCoder' Schieder
> Registered Linux User #289529: http://counter.li.org
> finger blindcoder@scavenger.homeip.net | gpg --import


If you meant to send error messages to the screen, then this is the
correct syntax. However, if you want to send both stderr and stdout to the
logfile, the command should be:

unzip file.zip >unzip.logfile 2>&1

Tricky stuff, redirection.

HTH,
Eric
Benjamin Schieder

2006-01-29, 9:31 pm

Eric van der Meer wrote:
> In article <43d7baea$0$20777$9b4e6d93@newsread4.arcor-online.net>,
> Benjamin Schieder <blindcoder@scavenger.homeip.net> wrote:
>
>
>
>
> If you meant to send error messages to the screen, then this is the
> correct syntax. However, if you want to send both stderr and stdout to the
> logfile, the command should be:
>
> unzip file.zip >unzip.logfile 2>&1
>
> Tricky stuff, redirection.


Ah yes, there was this thing about the order of the redirectors.

Sorry,
Benjamin

--
Today, memory either forgets things when you don't want it to,
or remembers things long after they're better forgotten.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com