in reply to match two files
Here is simple solution:
#!/usr/bin/perl my @tmp1 = map { chomp; [ split /\s+/, $_, -1 ] } `cat tmp01`; # (*) my %tmp2 = map { chomp; my @a = split /\s+/, $_, -1; ($a[0], \@a) } `cat tmp02`; print join "\t" @$_, @{ $tmp2{$$_[0]} }, "\n" for @tmp1; # (*) instead of `cat tmp01` it is more safe to: #use Path::Tiny; #path("tmp01")->lines_utf8({chomp => 1});
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: match two files
by GrandFather (Saint) on Dec 10, 2020 at 21:01 UTC | |
by leszekdubiel (Scribe) on Dec 11, 2020 at 21:31 UTC | |
|
Re^2: match two files
by afoken (Chancellor) on Dec 11, 2020 at 15:42 UTC |