in reply to how to find last word match ?

The problem is how could i read the input file and get the last word match with "Baki".

What do you think?

Replies are listed 'Best First'.
Re^2: how to find last word match ?
by bh_perl (Monk) on Nov 24, 2010 at 07:27 UTC
    <hi>
    This is my opinion by using shell script
    system ("cat file.txt |grep "Baki" |tail -1");
        perl -e 'print((grep/Baki/,<>)[-1])' file.txt