in reply to Re^3: Insert and attach sequence of words in txt file if it exist in other file
in thread Insert and attach sequence of words in txt file if it exist in other file

yes
  • Comment on Re^4: Insert and attach sequence of words in txt file if it exist in other file

Replies are listed 'Best First'.
Re^5: Insert and attach sequence of words in txt file if it exist in other file
by poj (Abbot) on May 13, 2017 at 20:48 UTC

    In that case just remove it, add text and then add it back

    while (<FILE1>){ chomp; my @words = split /[ \.]/,$_; my @added; for (@words){ push @added,$file2{$_} if exists $file2{$_}; }; s/\.$//; print FILE3 $_,(join ' ',@added),".\n"; }
    poj
      sorry but that is what i have exactly in a.txt <title>The Original series began in 1864 and continues to the present.</title> and that i want in r.txt <title>The Original series began in 1864 and continues to the present serieszzgoodzznicezzsummer nightzzpresentzzfriends.</title>

        Are all the word sequences enclosed in title tags like that ?

        <title>The Original series began in 1864 and continues to the present.</title>
        

        If not please show more examples.

        poj