in reply to Re: Extracting specific Data
in thread Extracting specific Data

Well that is working completely fine. Thanks a lot!!!

Replies are listed 'Best First'.
Re^3: Extracting specific Data
by maheshkumar (Sexton) on Jun 26, 2012 at 13:56 UTC

    Okay what if I had a file from which i had to extract data between those two words. But dont want it to match globally. For instance the word1 and word2 appears the first time it prints the data between them, and word1 again appears somewhere in the file and word2 also appears again. So it is like chunks of data through the file between the ~"word1" and "word2".... Nothing happens when i remove the match global (mg) at the end of the specified words...

      And what are the requirements when regions overlap? And what if start/end words double?

      You should look into constructs like

      $ perl -ne'/start/i .. /end/i and print' file $ perl -ne'/\b start \b/ix ... /\b end \b/ix and print' file

      And start reading :)


      Enjoy, Have FUN! H.Merijn