Home > Archive > PERL Beginners > July 2006 > File opeartions help
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
File opeartions help
|
|
| Irfan Sayed 2006-07-27, 6:57 pm |
| Hi,
I am executing following code. i need to send the output of
system($cmd); command to the file . how do i do that
plz help
Regards
Irfan.
#########/usr/atria/bin/Perl -w
use strict;
use warnings;
my $CT = "/usr/atria/bin/cleartool";
my @vob_list = `$CT lsvob -s`;
my $fname = "/tmp/vob_trigger";
open FILE,">>",$fname or die $!;
foreach (@vob_list)
{
print "Following are the triggers applied for $_ VOB\n\n";
my $cmd = "$CT lstype -kind trtype -invob $_";
system($cmd);
print " ****************************************
*******\n\n";
}
| |
| Hal Wigoda 2006-07-27, 6:57 pm |
| why do you keep on asking the same question?????????
On Jul 27, 2006, at 9:47 AM, Sayed, Irfan ((Irfan)) wrote:
> Hi,
>
> I am executing following code. i need to send the output of
> system($cmd); command to the file . how do i do that
>
> plz help
>
> Regards
> Irfan.
>
>
>
> #########/usr/atria/bin/Perl -w
>
> use strict;
> use warnings;
> my $CT = "/usr/atria/bin/cleartool";
> my @vob_list = `$CT lsvob -s`;
>
> my $fname = "/tmp/vob_trigger";
> open FILE,">>",$fname or die $!;
>
> foreach (@vob_list)
> {
> print "Following are the triggers applied for $_ VOB\n\n";
> my $cmd = "$CT lstype -kind trtype -invob $_";
> system($cmd);
> print " ****************************************
*******\n\n";
> }
>
| |
| DJ Stunks 2006-07-27, 6:57 pm |
| Irfan Sayed wrote:
> Hi,
>
> I am executing following code. i need to send the output of
> system($cmd); command to the file . how do i do that
>
> plz help
>
> Regards
> Irfan.
>
>
>
> #########/usr/atria/bin/Perl -w
>
> use strict;
> use warnings;
> my $CT = "/usr/atria/bin/cleartool";
> my @vob_list = `$CT lsvob -s`;
>
> my $fname = "/tmp/vob_trigger";
> open FILE,">>",$fname or die $!;
>
> foreach (@vob_list)
> {
> print "Following are the triggers applied for $_ VOB\n\n";
> my $cmd = "$CT lstype -kind trtype -invob $_";
> system($cmd);
> print " ****************************************
*******\n\n";
> }
>
Irfan, you consistently amaze me. What kind of deadline do you have on
this project? You've been asking about this 20-line script for like 3
w s. It definitely explains the quality of our Avaya PABX though....
Anyway, to answer your 1,000,000th question about this script (confetti
please):
1) you already know how to capture the output from an external program
2) you already appear to know how to open a file for writing
Soooooo: maybe you should capture the output, and, (wait for it) write
it to the file!
Hallelujah!
-jp
| |
| Timothy Johnson 2006-07-27, 6:57 pm |
| Try backticks instead of the system() call to capture the outputh.
E.g. my @results =3D `$cmd`;
-----Original Message-----
From: Sayed, Irfan (Irfan) [mailto:isayed@avaya.com]=20
Sent: Thursday, July 27, 2006 7:48 AM
To: beginners@perl.org
Subject: File opeartions help
Hi,
=20
I am executing following code. i need to send the output of
system($cmd); command to the file . how do i do that=20
=20
<snip>
|
|
|
|
|