Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I output TSM error information into an array?

Status
Not open for further replies.

Newbee21369

Programmer
Oct 13, 2004
30
US
I'm trying to write the output of the TSM stdout and TSM stderr into an array. I've only been able to write my output to a file. Any suggestions?

This is how I wrote it to a file.
system("$TSM_COMMAND 1>TSM_Output.stdout 2>TSM_Output.stderr");
 
Not sure what you mean by TSM but collecting stdout from a process is not too difficult.

use backticks instead of the system command:

Code:
my @array = `$TSM_COMMAND 2> file.stderr`;
 
tsm... terminal session manager on hp-ux?

No matter - if it won't write to a standard pipe you can kid it into thinking it's writing to a file by creating a named pipe and then have it write to that while your perl process reads from it.

Have a look at the man page for mknod.

Mike

You cannot really appreciate Dilbert unless you've read it in the
original Klingon.

Want great answers to your Tek-Tips questions? Have a look at faq219-2884

 
Oh Right :)

My comments about named pipes still stand though.

Mike

You cannot really appreciate Dilbert unless you've read it in the
original Klingon.

Want great answers to your Tek-Tips questions? Have a look at faq219-2884

 
I'm sending data in the files TSM_Output.stdout and TSM_Output.stderr that I know I can open the files and read from it if I choose to. However, I wanted to not have to do all that work if there is another way to capture the data in an array.

I need the system command in order to execute the TSM command.

Thanks!

system("$TSM_COMMAND 1>TSM_Output.stdout 2>TSM_Output.stderr");
 
This worked!!!

my @array = `$TSM_COMMAND 2> file.stderr`;

foreach $line(@array)
{
TMH::writeConsole(*LOGFILE,"PRINT TSM INFO: $line\n");

print "$line";
}


Thanks!!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top