hope I don't get killed for potentially posting under the wrong forum. ) I did think hard about where this belongs...
Basically I have a simple line of code which is not producing what I expect when I run it from a perl script.
It does however work when run directly from the prompt:
fgrep "ERROR" file_output.txt | nawk ' { print $2 } '
This produces what I'd expect:
(Failed
(Failed
However when I run from the pl script it returns the entire string, and not the "2nd field". Here's the simplified perl script:
#!/sbcimp/run/pd/perl/prod/bin/perl
$temp_txt=`fgrep "ERROR" file_output.txt | nawk ' { print $2 } '`;
print $temp_txt;
File content is as follows:
ERROR1 (Failed to match)
SUCCESS (Matching)
ERROR2 (Failed to update)
Can anyone give me any pointers please? I've stared at this for ages now, I know I am being thick, and the solution is more than likely real simple, but hey....
Thanks a bundle.
Basically I have a simple line of code which is not producing what I expect when I run it from a perl script.
It does however work when run directly from the prompt:
fgrep "ERROR" file_output.txt | nawk ' { print $2 } '
This produces what I'd expect:
(Failed
(Failed
However when I run from the pl script it returns the entire string, and not the "2nd field". Here's the simplified perl script:
#!/sbcimp/run/pd/perl/prod/bin/perl
$temp_txt=`fgrep "ERROR" file_output.txt | nawk ' { print $2 } '`;
print $temp_txt;
File content is as follows:
ERROR1 (Failed to match)
SUCCESS (Matching)
ERROR2 (Failed to update)
Can anyone give me any pointers please? I've stared at this for ages now, I know I am being thick, and the solution is more than likely real simple, but hey....
Thanks a bundle.