Sponsored Content
Top Forums Shell Programming and Scripting Perl: combine Backtick & system() I/O operation? Post 302425822 by jeffw_00 on Sunday 30th of May 2010 02:18:46 PM
Old 05-30-2010
well, first, apparently ActivePerl doesn't support Tee. But if it did, are you saying this would work?

Code:
#!/usr/bin/perl -w

use Tee;

tee("dir",@results); # puts output of "dir" results to screen, and into @results

foreach $line (@results) {  # now print the results again just to show they were captured in the array
    print $line;
}

thanks
/j

Last edited by Scott; 05-30-2010 at 07:56 PM.. Reason: Code tags, please...
 

10 More Discussions You Might Find Interesting

1. UNIX Desktop Questions & Answers

Multi operation system in one pc.

Does anyone can write a thread to teach me how to install Windows 2000, RH Linux, and FreeBSD unix in one machine step by step? Or someone's already done with this topic? (1 Reply)
Discussion started by: HOUSCOUS
1 Replies

2. Ubuntu

where can i get the unix operation system?

I am a stranger here ,where can i get the operation for free.thank you! (2 Replies)
Discussion started by: tcb3210
2 Replies

3. UNIX for Dummies Questions & Answers

what does the operation '>&' mean in a shell script

hi, all, i saw a syntax like this usr/local/mpiexec -np 8 /home/XXXX/program_exe >& ./temp/out the output will be put into ./temp/out. I want to know the meaning of the operation symbol '>&'. Thanks (3 Replies)
Discussion started by: cy163
3 Replies

4. Shell Programming and Scripting

combine two perl lines into a single perl command

Hi Everyone, i have a string 00:44:40 so: $tmp=~ s/://gi; $tmp=~s/({2})({2})({2})/$1*3600+$2*60+$3/e; the output is 2680. Any way to combine this two lines into a single line? Thanks (4 Replies)
Discussion started by: jimmy_y
4 Replies

5. Shell Programming and Scripting

Perl: Backtick Errors

When trying to use backticks for system commands, is there a way to read the error messages if a command doesn't execute properly? I have no problem getting the results if the command is properly executed. Ex. my @result = `dir`; foreach my $line (@result) { print "Result = $line";... (2 Replies)
Discussion started by: kooshi
2 Replies

6. Linux

commands of linux operation system

Am actually am new to the linux operating system and knda wana knw more about it.Please could u help me with some commands so i can start with that first.Really need your help (5 Replies)
Discussion started by: GODBLESSME
5 Replies

7. UNIX for Dummies Questions & Answers

system calls and atomic operation

Are system calls atomic operations? Is a system call can be interrupted? (2 Replies)
Discussion started by: vistastar
2 Replies

8. Shell Programming and Scripting

Enter third column & Perform Operation

I am trying to enter a third column in this file, but the third column should that I call "Math" perform a some math calculations based on the value found in column #2. Here is the input file: Here is the desired output: Output GERk0203078$ Levir Math Cotete_1... (5 Replies)
Discussion started by: Ernst
5 Replies

9. AIX

Monitoring AIX with System Center Operation Manager 2007 R2

I can get my AIX servers to show up in SCOM but I'm struggling with running personal scripts and have the result of these scripts show up in SCOM. I'm currently using BigBrother and I've written some scripts for BB. I would like to convert these scripts to something that can be used in SCOM. ... (0 Replies)
Discussion started by: petervg
0 Replies

10. Shell Programming and Scripting

Help me to perform count & group by operation in shell scripting?

Hi All, I want to display the distinct values in the file and for each distinct value how may occurance or there. Test data: test1.dat 20121105 20121105 20121105 20121105 20121106 20121106 20121106 20121105 I need to display the output like Output (2 Replies)
Discussion started by: bbc17484
2 Replies
XML::Filter::Tee(3pm)					User Contributed Perl Documentation				     XML::Filter::Tee(3pm)

NAME
XML::Filter::Tee - Send SAX events to multiple processor, with switching SYNOPSIS
my $t = XML::Filter::Tee->new( { Handler => $h0 }, { Handler => $h1 }, { Handler => $h2 }, ... ); ## Altering the handlers list: $t->set_handlers( $h0, $h1, $h2, $h3 ); ## Controlling flow to a handler by number and by reference: $t->disable_handler( 0 ); $t->enable_handler( 0 ); $t->disable_handler( $h0 ); $t->enable_handler( $h0 ); ## Use in a SAX machine (though see L<XML::SAX::Pipeline> and ## L<XML::SAX::Tap> for a more convenient way to build a machine ## like this): my $m = Machine( [ Intake => "XML::Filter::Tee" => qw( A B ) ], [ A => ">>log.xml" ], [ B => *OUTPUT ], ); DESCRIPTION
XML::Filter::Tee is a SAX filter that passes each event it receives on to a list of downstream handlers. It's like XML::Filter::SAXT in that the events are not buffered; each event is sent first to the tap, and then to the branch (this is different from XML::SAX::Dispatcher, which buffers the events). Unlike XML::Filter::SAXT, it allows it's list of handlers to be reconfigured (via "set_handlers") and it allows control over which handlers are allowed to receive events. These features are designed to make XML::Filter::Tee instances more useful with SAX machines, but they to add some overhead relative to XML::Filter::SAXT. The events are not copied, since they may be data structures that are difficult or impossibly to copy properly, like parts of a C-based DOM implementation. This means that the handlers must not alter the events or later handlers will see the alterations. METHODS
new my $t = XML::Filter::Tee->new( { Handler => $h0 }, { Handler => $h1 }, { Handler => $h2 }, ... ); set_handlers $t->set_handlers( $h0, $h1, $h2 ); $t->set_handlers( { Handler => $h0, }, { Handler => $h1, }, ); Replaces the current list of handlers with new ones. Can also name handlers to make enabling/disabling them by name easier: $m->set_handlers( { Handler => $validator, Name => "Validator", }, { Handler => $outputer, }, ); $m->disable_handler( "Validator" ); disable_handler $t->disable_handler( 0 ); ## By location $t->disable_handler( "Validator" ); ## By name $t->disable_handler( $h0 ); ## By reference Stops sending events to the indicated handler. enable_handler $t->enable_handler( 0 ); ## By location $t->enable_handler( "Validator" ); ## By name $t->enable_handler( $h0 ); ## By reference Stops sending events to the indicated handler. AUTHOR
Barrie Slaymaker <barries@slaysys.com> COPYRIGHT
Copyright 2002, Barrie Slaymaker, All Rights Reserved You may use this module under the terms of the Artistic, GNU Public, or BSD licenses, as you choose. perl v5.10.0 2009-06-11 XML::Filter::Tee(3pm)
All times are GMT -4. The time now is 06:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy