Dear all,
I have no problem using the following command of AWK as a stand alone command, without any error:
$ awk '$9 != "NTM" && $9 != ""' myfile.txt | less -Sn
But when I apply them inside Perl's script for qsub (i.e. running job in linux cluster) command, like this:
use strict;
use Data::Dumper;
use Carp;
use File::Basename;
my $path = "/mypath/";
my @files = glob($path."*.txt");
foreach my $file ( @files ) {
print "$file\n";
wy $base = basename($file,".fc-gn_".$type);
my $nn = $path.$base.".out";
print "$file $nn\n";
open PIPE, "| qsub" or die $!;
print PIPE <<EOF;
#!/bin/sh
#PBS -N CLEAN
#PBS -l nodes=1:ppn=2
#PBS -r n
awk '$9 != "NTM" && $9 !=""' $file > $nn
EOF
}
It gave the following error
awk: cmd. line:1: != "NTM" && !=""
awk: cmd. line:1: ^ syntax error
What's the right way to do it?