Hello monks, I have a small problem with multi-line regexs, I had posted this question before but the code I posted was incomplete. I am performing this multi-line regex on a C map file. Here is the perl code
#!/usr/local/bin/perl -w # analyse_map.perl # Generate a snapshot of audio registers using register log file, # Open map files (map_merc and rom.dld) open(MAP, "<map_merc") || die "Unable to open map_merc"; # Read map_merc : while(<MAP>) { if( ($titi, $toto) = /^\.(\w+).+$\^\t+\.\w+\W+(\w+)/m) { print($titi, $toto, " ", $., "\n"); } } close(MAP);
The target I am trying to scan for data is given below (just a dew lines as the file is too big)
output input virtual section section address size file .begin 00002000 00000068 .begin a0000000 00000068 begin_flash.o _START a0000000 00000000 .copy_flash 00000000 00001488 .copy_flash a0001000 000001ac libbsp_qt1_aspic32.a[copy +_flash.o] copy_from_flash a0001000 00000000 .copy_flash a00011ac 00000978 libbsp_qt1_aspic32.a[cach +3940.o] SysDisableDCache a00011ac 00000000 disableD a0001220 00000000 SysDisableICache a0001294 00000000 disableI a0001308 00000000 SysEnableDCache a000137c 00000000 enableD a00013f8 00000000 SysEnableICache a0001464 00000000 .text 00003000 00052be4 .boot 80003000 0000009c libbsp_qt1_aspic32.a[boot +.o] HdwInit 80003000 00000000 end_SIF 80003080 00000000 .endtext 80055be4 00000000 .endtext 80055be4 00000000 end.o TextEnd 80055be4 00000000 .data 00180000 000004d0 .data 80201000 00000000 begin_flash.o StartData 80201000 00000000
The thing I am trying to do is scan the line that begins with "." eg .begin etc and put it in the scalar $titi and then if there is a line just below which starts with a tab and then ".", get the second part which is the address. I hope this explaination is clear enough. If you need more explaination mail me at satyajeet.navalkar@philips.com Thanx. Saty

In reply to Multi-line regex by saty

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.