http://qs321.pair.com?node_id=11124874


in reply to match two files

#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11124864 use warnings; use Path::Tiny; my %two = map /^(\d+)(.*)/, path('tmp02')->lines; my $out = "PeptideID ProteinID SpectrumID Sequence\n"; s/^(\d+)(.*)/$1$2$two{$1}/ and $out .= $_ for path('tmp01')->lines; path('tmp11_quick')->spew($out);

Replies are listed 'Best First'.
Re^2: match two files
by yueli711 (Sexton) on Dec 09, 2020 at 16:45 UTC

    Hello tybalt89, Thank yo so much for your great help! It works, but still has a problem. Thank you again and really appreciated! Best, Yue

    Use of uninitialized value in concatenation (.) or string at match_qui +ck03.pl line 9.

      Please give a (small) dataset that shows that problem.

        Hello tybalt89, Thank you so much for your great help! The code is correct! A small question: How can 6 and 109521 separated with "Tab"? It looks they are separated with space. Thank you again and really appreciated! Best, Yue
        PeptideID ProteinID SpectrumID Sequence 6 109521 53663 KMGEGR 7 741 53663 KPPSGK 11 681 144492 NNDALR 11 780 144492 NNDALR 20 2352 15547 SPAKPK 27 1490 55547 LHKPPK 27 1491 55547 LHKPPK 27 1492 55547 LHKPPK 28 51996 55547 LFVGRK 29 1490 55504 LHKPPK 29 1491 55504 LHKPPK 29 1492 55504 LHKPPK 30 1490 55602 LHKPPK 30 1491 55602 LHKPPK 30 1492 55602 LHKPPK