Re: help with awk command in perl



Sayed, Irfan (Irfan) wrote:
Hi All,

Hello,

I have a following script in perl in which i am using awk command but it
is not getting executed properly.


# /usr/atria/bin/Perl -w

use strict;
use warnings;

my $fname = "/tmp/checkvob_log";
open(FILE,">>$fname");


my $CT = "/usr/atria/bin/cleartool";

my @vob_list = `$CT lsvob -s`;

my @vob_list1 = `$CT lsvob`;

print FILE @vob_list1;

my $cmd1 = "awk '{print $3}' /tmp/checkvob_log";

my @vob_path = qx{$cmd1};

print @vob_list;
print @vob_path;

Why not just do that in perl:


#!/usr/atria/bin/Perl
use strict;
use warnings;

my $fname = '/tmp/checkvob_log';
open FILE, '>>', $fname or die "Cannot open '$fname' $!";

my $CT = '/usr/atria/bin/cleartool';

my @vob_list = `$CT lsvob -s`;

my @vob_list1 = `$CT lsvob`;

print FILE @vob_list1;

open FILE, '<', $fname or die "Cannot open '$fname' $!";

my @vob_path = map { ( split )[ 2 ] } @vob_list1;

print @vob_list;
print @vob_path;




John
--
use Perl;
program
fulfillment
.



Relevant Pages

  • Re: help with awk command in perl
    ... use strict; ... use warnings; ... my @vob_list1 = `$CT lsvob`; ... print FILE @vob_list1; ...
    (perl.beginners)
  • Proper output
    ... # Perl script to change the replica name ... use strict; ... use warnings; ... print FILE @vob_list; ...
    (perl.beginners)
  • file help
    ... use strict; ... use warnings; ... foreach ... print FILE $out; ...
    (perl.beginners)
  • Re: Sharing variables between modules
    ... use strict; ... use warnings; ... # Note that this must also come *before* the use Foo line. ... package Foo; ...
    (comp.lang.perl.misc)
  • Re: Dynamic directory handles?
    ... > 1) You should always enable warnings (and strict) when ... > perldoc -q filehandle ... >> sub dircount { ... > use warnings; ...
    (comp.lang.perl.misc)