Can anyone assist ? I have a large .txt (115,000 lines) that contains many variable length sub-sections stacked on top of each other; I need to extract each subsection text between Common seperators & save extraction to a seperate text file (with *.LOG extension). The extract file name is embedded in Line 3 of each subsection eg "gOILp_u" Given file size Need to automate/loop/ this RegEx process with a Perl script/function.

For each subsection: ------ Start String: "WinSolve log file created " End String: "Exit" File Name to Save Extracted subsection text to: Occurs on Line 3 of each subsection

(eg1 1st subsection Line 3 reads:

@ gRSH1p_u @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

(eg2 2nd subsection Line 3 reads:

@ gOILp_u @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

So 1st subsection => saved to c:\data\ws3\sim\LOGS\gRSH1p_u.LOG So 2nd subsection => saved to c:\data\ws3\sim\LOGS\gRSH1p_u.LOG

SECTION (TOP) OF LARGE FILE TO BE SPLIT:------------------
WinSolve log file created @ @ gRSH1p_u @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ [TRUNCATED SUBSECTION TEXT] @ Exit @ WinSolve log file created @ @ gOILp_u @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ [TRUNCATED SUBSECTION TEXT] @ Exit @ WinSolve log file created @ @ gTRX1p_u @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ [TRUNCATED SUBSECTION TEXT] @ Exit
etc etc

SUMMARY OF REQUIREMENT --------------

1st subsection, extract all text between "WinSolve log file created " & "Exit" ; save to c:\data\ws3\sim\LOGS\gRSH1p_u.LOG

2nd subsection, extract all text between "WinSolve log file created " & "Exit" ; save to c:\data\ws3\sim\LOGS\gOILp_u.LOG

3rd subsection, extract all text between "WinSolve log file created " & "Exit" ; save to c:\data\ws3\sim\LOGS\gTRX1p_u.LOG etc etc


In reply to PERL TO SPLIT BIGFILE;SAVE TEXT EXTRACTS TO SEPERATE FILES by MT_MANC

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.