Sponsored Content
Top Forums Shell Programming and Scripting Perl :How to print the o/p of a Perl script on console and redirecting same in log file @ same time. Post 302487675 by butterfly20 on Thursday 13th of January 2011 07:35:05 AM
Old 01-13-2011
Yes...found a way.

open (STDOUT, "| tee -ai log.txt");
print "blah blah";
close (STDOUT);

This works perfectly. Thanks ghostdog74 Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

perl - print to a log file and screen

as the title suggests, i need to print a user message to a log file and the screen using perl. in unix i set up a function using 'tee' like so function Display_Message { echo "$*" | tee -ai $LOGFILE } the following command then obviously displays to the screen and prints to a log... (6 Replies)
Discussion started by: mjays
6 Replies

2. Shell Programming and Scripting

Perl or Shell script to read a transaction log in real time

Hello, I have a Apache webserver running on RedHat. Its primary function is a proxy server for users accessing the internet. I have a transaction log that logs every transactions of every users. For users trying to access certain sites/content the transactions goes into a 302 redirect loop and... (2 Replies)
Discussion started by: bruno406
2 Replies

3. Shell Programming and Scripting

Perl script issue: print

Can someone tell me what I'm doing wrong with my perl script? I am new to Perl. This isn't even the final script, I'm just testing to see if it will print the directories with the files in it. For some reason my output is only printing the 1st, 6th, and last entries of the @sub_dir array. Each... (3 Replies)
Discussion started by: man
3 Replies

4. Shell Programming and Scripting

Perl Print Problems in script

Hi Perl Gurus, perl -e 'print "http://www.site@domain.com"' The output of the above is : http://www.site.com" I want to print http://www.site@domain.com without using escape sequence before '@' like '\@'. Is there any way to do this in perl? Thanks, Som (1 Reply)
Discussion started by: som.nitk
1 Replies

5. Shell Programming and Scripting

Redirecting output to both console and to a file

Hi All, Is there a way in Bash we can redirection some output to both console and the file at the same time. ~Parag (2 Replies)
Discussion started by: paragkalra
2 Replies

6. Shell Programming and Scripting

perl script to print file information - newbie

Hi I have a perl script that prints all the video and audio file information(playing duration). It works fine in one of my friends linux laptop. But it doesn't work in my both windows and linux. My friend told me I have to do install some module ( ppm instal ...... ) but I have no... (1 Reply)
Discussion started by: srijith
1 Replies

7. Web Development

problem with exporting vairable from one perl cgi to another perl cgi script while redirecting.

Can anyone tell me how to export a variable from one perl CGI script to another perl cgi script when using a redirect. Upon running the login.pl the user is prompted to enter user name and password. Upon entering the correct credentials (admin/admin) the user is redirected to welcome page. My... (3 Replies)
Discussion started by: Arun_Linux
3 Replies

8. Shell Programming and Scripting

[Shell/Perl(?)] Prepending timestamps to console output & writing results to a file

I do a lot of TSM work and I embarked on what I thought would be an easy task, and I'd be very happy for any input to save the pounding my keyboard is receiving :] By default, the output of TSM's console has no timestamping, making it hard to sort through accurately. This puts my console into... (5 Replies)
Discussion started by: Vryali
5 Replies

9. Shell Programming and Scripting

Time out set in perl script

Hi, I am preparing a perl script, which will run some commads on remote Linux servers. I have a file contains all the servers names one by one like below vi servers.txt srv1 srv2 srv3 Now, I need to prepare a perl script to ssh (or)rsh to each server in the above... (1 Reply)
Discussion started by: kumar85shiv
1 Replies

10. Programming

PERL: In a perl-scripttTrying to execute another perl-script that SETS SOME VARIABLES !

I have reviewed many examples on-line about running another process (either PERL or shell command or a program), but do not find any usefull for my needs way. (Reviewed and not useful the system(), 'back ticks', exec() and open()) I would like to run another PERL-script from first one, not... (1 Reply)
Discussion started by: alex_5161
1 Replies
IO::Pager::Unbuffered(3)				User Contributed Perl Documentation				  IO::Pager::Unbuffered(3)

NAME
IO::Pager::Unbuffered - Pipe output to PAGER if destination is a TTY SYNOPSIS
use IO::Pager::Unbuffered; { local $STDOUT = IO::Pager::Unbuffered::open *STDOUT; print <<" HEREDOC" ; ... A bunch of text later HEREDOC } { # You can also use scalar filehandles... my $token = IO::Pager::Unbuffered::open($FH) or warn($!); print $FH "No globs or barewords for us thanks! "; } { # ...or an object interface my $token = new IO::Pager::Unbuffered; $token->print("OO shiny... "); } DESCRIPTION
IO::Pager subclasses are designed to programmatically decide whether or not to pipe a filehandle's output to a program specified in PAGER; determined and set by IO::Pager at runtime if not yet defined. See IO::Pager for method details. METHODS
All methods are inherited from IO::Pager; except for instantiation. CAVEATS
You probably want to do something with SIGPIPE eg; eval { $SIG{PIPE} = sub { die }; local $STDOUT = IO::Pager::open(*STDOUT); while (1) { # Do something } } # Do something else SEE ALSO
IO::Pager, IO::Pager::Buffered, IO::Pager::Page, AUTHOR
Jerrad Pierce <jpierce@cpan.org> Florent Angly <florent.angly@gmail.com> This module was inspired by Monte Mitzelfelt's IO::Page 0.02 Significant proddage provided by Tye McQueen. COPYRIGHT AND LICENSE
Copyright (C) 2003-2012 Jerrad Pierce o Thou shalt not claim ownership of unmodified materials. o Thou shalt not claim whole ownership of modified materials. o Thou shalt grant the indemnity of the provider of materials. o Thou shalt use and dispense freely without other restrictions. Or, if you prefer: This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.0 or, at your option, any later version of Perl 5 you may have available. perl v5.16.2 2012-09-04 IO::Pager::Unbuffered(3)
All times are GMT -4. The time now is 08:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy