RE: sending output to file and terminal (in Unix use "tee")



If you are on a Unix platform, you can use "tee" in your script to
direct output to two places at the same time.

- Matt

-----Original Message-----
From: John W. Krahn [mailto:krahnj@xxxxxxxxx]
Sent: Thursday, March 29, 2007 2:17 AM
To: Perl Beginners
Subject: Re: sending output to file and terminal

lakshmi priya wrote:
Hi all,

Hello,

I have written a perl script that prints the output to the
terminal. I also want to write the output to a file. So, what I have
done is write the output to a file and then print the file. I was just

wondering if there any way to write to both - terminal and file at the
same time?

perldoc -q "How do I print to more than one file at once"




John
--
Perl isn't a toolbox, but a small machine shop where you can
special-order
certain sorts of tools at low cost and in short order. -- Larry
Wall

--
To unsubscribe, e-mail: beginners-unsubscribe@xxxxxxxx For additional
commands, e-mail: beginners-help@xxxxxxxx http://learn.perl.org/


.



Relevant Pages

  • Re: How to script Xilinx ISE - xflow, batch file, tcl, ?
    ... In the past when I have wanted to use a script with ISE I have always ... We perform most of our development on Linux workstations and execute ... .pcf | tee -ai pnr.log ... Here's a method we've used to automagically modify a register setting ...
    (comp.arch.fpga)
  • Re: Print to stdout and pipe at the same time
    ... script | tee OUT ... Written in 2009 by Kaz Kylheku ... int main(int argc, char **argv) ...
    (comp.unix.shell)
  • Re: possible shell script solution
    ... > your methods and tried to digest them and even tested a few, ... > to list directories and files by simply listing their name, ... > display the figures at the bottom of the script. ... tee /dev/tty | ...
    (comp.unix.solaris)
  • Re: Insert character at a fixed position of lines
    ... I'd expect fileout.pdb to be zero bytes, what you have piped to tee ... fileout.pdb is the stdout of your script, ... In Python, stdin and stdout is a file- ...
    (comp.lang.python)