in reply to Re^2: 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

Is the . always at the end of the line ?

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

Replies are listed 'Best First'.
Re^4: Insert and attach sequence of words in txt file if it exist in other file
by shoura (Novice) on May 13, 2017 at 20:44 UTC
    yes

      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>