Re: help with awk command in perl



On 08/29/2006 10:40 AM, Sayed, Irfan (Irfan) wrote:
Hi All,
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");

Check if the open failed. Read "perldoc -f open."


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";
[...]

That $3 is expanded inside the perl interpreter--long before awk gets it. Put a backslash in front of it to delay expansion.



.



Relevant Pages

  • Re: Correctness vs. speed
    ... Modifying a script to take the most common situations into account ... In the awk command line or perl command line solution which would be ... easier to create and maintain for the OP, who needed a sort, as both are ... I think the awk command line solution is faster. ...
    (comp.os.linux.misc)
  • Re: awk command
    ... i am working on script. ... I have to use awk command and only get the MAR 21 to be displayed in ... You can do it in Perl: ...
    (comp.unix.programmer)
  • Re: Execute the Linux command on remote machine
    ... Irfan J Sayed wrote: ... but I have mentioned the absolute path then perl interpreter should ... Actually i want to parse the log file for errors which is on the remote machine. ... it basically is just looking for a absolute path to the Net folder in lib path. ...
    (perl.beginners)
  • Re: What does this mean?
    ... Thank you for your insight on formatting the awk command and your ... characters are not E. ... This is in a script I inherited from someone. ...
    (comp.lang.awk)
  • Re: Perl issue
    ... Sayed, Irfan wrote: ... The first thing that happens is that perl interpolates this as a double quoted ... current settings for that shell.) ... Also when a shell sees the newline ...
    (perl.beginners)