I used
paste Output1.txt Output2.txt | awk '{print $1, $2, $5, $15}'
inside perl script by using system(awk_commamd). I am getting error like
awk: {print , , , }
awk: ^ syntax error
Need help to sort this error
Duplicating the work of paste and awk using pure 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";
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With