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
MAILPARSE_UUDECODE_ALL(3)						 1						 MAILPARSE_UUDECODE_ALL(3)

mailparse_uudecode_all - Scans the data from fp and extract each embedded uuencoded file

SYNOPSIS
array mailparse_uudecode_all (resource $fp) DESCRIPTION
Scans the data from the given file pointer and extract each embedded uuencoded file into a temporary file. PARAMETERS
o $fp - A valid file pointer. RETURN VALUES
Returns an array of associative arrays listing filename information. +-------------+-------------------------------------------------+ | | | | filename | | | | | | | Path to the temporary file name created | | | | | | | |origfilename | | | | | | | The original filename, for uuencoded parts only | | | | +-------------+-------------------------------------------------+ The first filename entry is the message body. The next entries are the decoded uuencoded files. EXAMPLES
Example #1 mailparse_uudecode_all(3) example <?php $text = <<<EOD To: fred@example.com hello, this is some text hello. blah blah blah. begin 644 test.txt /=&AI<R!I<R!A('1E<W0* ` end EOD; $fp = tmpfile(); fwrite($fp, $text); $data = mailparse_uudecode_all($fp); echo "BODY "; readfile($data[0]["filename"]); echo "UUE ({$data[1]['origfilename']}) "; readfile($data[1]["filename"]); // Clean up unlink($data[0]["filename"]); unlink($data[1]["filename"]); ?> The above example will output: BODY To: fred@example.com hello, this is some text hello. blah blah blah. UUE (test.txt) this is a test PHP Documentation Group MAILPARSE_UUDECODE_ALL(3)
All times are GMT -4. The time now is 12:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy