saty has asked for the wisdom of the Perl Monks concerning the following question:
This operation is performed on a C .map file which is listed below (juat a few lines) <CODE Link Editor Memory Map 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.acopy_flash.o copy_from_flash a0001000 00000000 .CpDstBg 00003000 00000000 .text 00003000 00052be4 .boot 80003000 0000009c libbsp_qt1_aspic32.aboot.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 </CODE> 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#!/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) = /^|\n\.(\w+).+\n\t+\.\w+\W+(\w+)/m) { print($titi, $toto, " ", $., "\n"); } } #close(MAP);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: multi-line regex again
by merlyn (Sage) on Aug 28, 2000 at 19:33 UTC | |
|
Re: multi-line regex again
by lindex (Friar) on Aug 28, 2000 at 16:03 UTC | |
by reptile (Monk) on Aug 28, 2000 at 18:50 UTC |