我用了
paste Output1.txt Output2.txt | awk '{print $1, $2, $5, $15}'
Run Code Online (Sandbox Code Playgroud)
使用system(awk_commamd)在perl脚本中.我得到的错误就像
awk: {print , , , }
awk: ^ syntax error
Run Code Online (Sandbox Code Playgroud)
需要帮助来排序此错误
复制paste和awk使用纯perl 的工作:
use strict;
use warnings;
use autodie;
my @fhs = map {open my $fh, '<', $_; $fh} qw(Output1.txt Output2.txt);
while (grep {!eof $_} @fhs) {
my @lines = map {(scalar <$_>) // ''} @fhs;
chomp @lines;
my @fields = split ' ', join "\t", @lines;
print join("\t", grep defined, @fields[0,1,4,14]), "\n";
}
Run Code Online (Sandbox Code Playgroud)