Hi, Why you add an empty line after the left / , does fc output start by empty line , if not try if($diff_abs =~ /^Comparing files $abs_file and $prev_abs$ ^\*\*\*\*\* $abs_file$ .. .. ..
/omi ...etc > >Hello > >I have a perl script that runs a software build on NT4. The final stage >of this build creates a binary file called "gsm_gp_flash.abs". I want to >compare this to the previous instance of this file to see if anything >has changed. These *.abs files contain a date stamp, so even running a >diff utility on the 2 files will report a difference. > >If I run NT's "fc" command on 2 of the files that were built using >exactly the same source fles (so in effect are the same apart from the >date stamp of when they were built) the difference looks like this (note >there is a blank line at the end of the output as well) > >Comparing files ..\OBJ\gsm_gp_flash.abs and ..\OBJ\GSM_GP_FLASH_PREV.ABS > >***** ..\OBJ\gsm_gp_flash.abs >%6.6s %9.9s >Sep 11 2002 >20:26:10 >Disconnecting... >***** ..\OBJ\GSM_GP_FLASH_PREV.ABS >%6.6s %9.9s >Sep 10 2002 >20:25:34 >Disconnecting... >***** > ><---end of output > >If that's all that gets output (allowing for different dates/times) then >I know there's no need to retest the *.abs file. > >Now the trouble I'm having is that I can' get what I thought would be a >relativly strightforward pattern matching exercise to work. The snippet >of the perl script that collects the diff output and does the test is > >my $prev_abs="..\\obj\\gsm_gp_flash_prev.abs"; >my $abs_file="..\\obj\\gsm_gp_flash.abs"; >my $months='(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)'; > ># collect the output of NT fc (file compare) command >$diff_abs = `fc /W $abs_file $prev_abs 2>&1`; > >if($diff_abs =~ >/ >^Comparing files $abs_file and $prev_abs$ >^\*\*\*\*\* $abs_file$ >^%6\.6s %9\.9s$ >^$months \d{1,2} \d\d\d\d$ >^\d\d:\d\d:\d\d$ >^Disconnecting\.\.\.$ >^\*\*\*\*\* $prev_abs$ >^%6.6s %9.9s$ >^$months \d{1,2} \d\d\d\d$ >^\d\d:\d\d:\d\d$ >^Disconnecting\.\.\.$ >^\*\*\*\*\*$ >^$ >/omi >) >{ > print "file only differ by embedded date\n"; >} > >I thought that using the /m modifier ought to allow me to delineate each >logical line of the string with ^.....$ > >To check I haven't made a basic goof with each line of the regular >expression that matches each line of the output above I've taken each >line of the output and tested them indivdually against each line of the >regular expression like so: > >$_ = "Comparing files ..\OBJ\gsm_gp_flash.abs and >...\OBJ\GSM_GP_FLASH_PREV.ABS"; >print "OK\n" if /^Comparing files $abs_file and $prev_abs$ /; > >...etc for each line of output, and it worked. > >I've also tried using the /s modifier and putting a "." at the end of >each line to match newlines, but again I can't get it to match. > >I suppose I could take the approach of just checking the length of the >$diff_abs string, it will always be a constant size for files that only >differ by their embedded dates, but I like to know what I'm missing with >the regular expression method. If anyone can see an obvious mistake or >put me straight on my understanding of multiline matching modifiers I'd >be grateful! > >Best wishes > >Reg Smith > >PS - if anyone was wondering why I'm calling NT's fc files compare >utility rather than say cygwin diff or even comparing the files in perl, >it's because cygwin diff doesn't report the actual diffs (just if they >are different, it's a binary file) and the files are quite big to think >about opening for reading (57 meg). Also fc with it's /W (ignore >whitespace diffs) is actually very fast, virtually instantaneous with my >two test files > > > >--------------------------------------------------------------------- > > E-mail Confidentiality Notice and Disclaimer > > This email and any files transmitted with it are confidential and are >intended solely for the use of the individual or entity to which they are >addressed. Access to this e-mail by anyone else is unauthorised. If you are >not the intended recipient, any disclosure, copying, distribution or any >action taken or omitted to be taken in reliance on it, is prohibited. > E-mail messages are not necessarily secure. Hitachi does not accept >responsibility for any changes made to this message after it was sent. > Please note that Hitachi checks outgoing e-mail messages for the >presence of computer viruses. > >--------------------------------------------------------------------- > > >-- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] _________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]