in reply to Re: read multi lines of a file in perl
in thread read multi lines of a file in perl

Hi Markov, Thanks for ur reply.. But i still have a small problem.. as this is able to check for only one loop and not repeated loop.. eg
process lkhls ksjhfk end process process kfhls kfh end process
i want output as
ksjhfk kfh
Thanks....

Replies are listed 'Best First'.
Re^3: read multi lines of a file in perl
by binf-jw (Monk) on Nov 05, 2008 at 15:33 UTC
    Do this if what only what you require is the bit between:
    print grep { !/process/ } <>;
    perl <script>.pl <input>.txt

    prints
    ksjhfk kfh

    You could also put this in an array
    my @process = grep { !/process/ } <>;
    However this would just be each element for each line. If you wanted them grouped you need something more complex using assertions ( if you do it the inefficent way like i have )
    John,

    UPDATE: This would group them
    { local undef $/; print split /process \s \w+ (.+?) end \s process/xms, <>; }

    P.S. Don't actually use these methods of doing it, There just other ways to do it.