redirect to > and to console ?

Dave Cinege dcinege at psychosis.com
Fri Jul 26 13:04:25 EDT 2002


On Friday 26 July 2002 4:57, Shagshag13 wrote:
> hello,
>
> i use many python script like that : ./myscript.py file_in > file_out
>
> i wish i would sometimes like to force output to be redirect to console
> instead of file file_out, is there any way of doing that ? (for example to
> display errors message while file_in will contain only data processed)
>
> (or should i do ./myscript.py file_in file_out > log.file and let myscript
> handle i/o ?)

If you want to be quick and dirty you can pipe to the 'tee' command

# tee --help
Usage: tee [OPTION]... [FILE]...
Copy standard input to each FILE, and also to standard output.

./myscript.py file_in | tee file.out

Understand stderr will still only go to the console. 
I *think* this is what you're asking...

-- 
The time is now 22:48 (Totalitarian)  -  http://www.ccops.org/





More information about the Python-list mailing list