Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re^2: Building a log file

by Marshall (Canon)
on Jun 23, 2009 at 15:20 UTC ( [id://774058]=note: print w/replies, xml ) Need Help??

in reply to Re: Building a log file
in thread Building a log file

This is a good idea. Windows systems don't have tee, I hacked in this awhile ago for my Windoze work. It is a simple program. The only tricky part is turning auto-flush on for write. Have fun to anybody who needs it.
#!/usr/bin/perl -w use strict; # tee program #### ###### # quickie tool $| =1; #flushes I/O for each write. sub usage { print "TEE USAGE:\n tees stdout to a file and to stdout\n". " program | tee outfile\n"; } my $filename = shift @ARGV; usage unless $filename; open (OUTFILE, '>', "$filename") or (die "Can't open OUTFILE: $!"); while (<>) { print; print OUTFILE; }

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://774058]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-05-22 18:52 GMT
Find Nodes?
    Voting Booth?

    No recent polls found