Dear all,
The solution proposed in posting 7633 (How do I extract all text between two keywords like start and end?) is not working for me. I have tried it and failed. (probably because I'm a perl newbie) A try with grep failed also (the "s" switch didn't work). Neither do I find other good examples on the net. Can somebody solve the problem?

My problem is the following:
  1. a 9 MB text file
  2. Multiple parts that must be extracted between "labels"
  3. The parts are not nested but successive
  4. The substracted parts must be in a CSV form
  5. It would be nice to have the label names in the csv
e.g.

start\n blabla\n ... blabla\n </i> begin:\n usefull information1\n usefull information2\n usefull information3\n end:\n blabla\n ... blabla\n \n start blabla\n ... blabla\n begin:\n usefull information1\n end:\n blabla\n etc etc

I hope you can help. Thanks in advance.
Firewall

edited by ybiC: my best effort at intended formatting, with <code> instead of unbalanced & unopened </p>s


In reply to Selecting text between given words (multi-lines (/n) and multiple occurrences) by nylon

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.