#!/usr/bin/perl -w my %bad; while (<DATA>) { if (/checking image file \<(NT-Development_\d+_FULL)\>/) { my $file = $1; # in case you ever change the regex below to ha +ve brackets do { $_ = <DATA>; $bad{$file}++ if /media does not exist/; } until /checking files file/; } } print join "\n", keys %bad; __DATA__ checking image file <NT-Development_1024371283_FULL> >copy 1 frag 1 media CC0202 host netbackup2: media does not exist >copy 1 frag 2 media CC0202 host netbackup2: media does not exist >copy 1 frag 3 media CC0202 host netbackup2: media does not exist >copy 1 frag 4 media CC0202 host netbackup2: media does not exist >copy 1 frag 5 media CC0202 host netbackup2: media does not exist checking files file <NT-Development_1024371283_FULL.f> checking image file <NT-Development_1026371283_FULL> checking files file checking image file <NT-Development_10243744283_FULL> >copy 1 frag 1 media CC0202 host netbackup2: media does not exist >copy 1 frag 2 media CC0202 host netbackup2: media does not exist checking files file <NT-Development_1024374483_FULL.f> __END__
dave hj~
In reply to Re: How to act upon lines between two other lines in file?
by dash2
in thread How to act upon lines between two other lines in file?
by blink
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |