С Perl вы можете сделать это так,
#!/usr/bin/perl
use strict;
use warnings;
my $file=$ARGV[0];
open my $fId, '<', $file or die "Error opeining file <$file>.";
my @qty = ();
my @price = ();
my @discount = ();
while(<$fId>){
chomp;
my @fields = split (/\t/, $_);
push @qty , $fields[1] if $fields[0] =~ m/Quantity/;
push @price , $fields[1] if $fields[0] =~ m/Price/;
push @discount , $fields[1] if $fields[0] =~ m/Discount/;
}
close $fId;
print "Quantity,Price,Discount\n";
for(my $i = 0; $i < scalar @qty; $i++){
print "$qty[$i],$price[$i],$discount[$i]\n";
}
Вам нужно будет передать имя файла в качестве аргумента.
например, ./ test.pl input_file