blob: c9b09680c0bb9cf76f11a87d97410af70f9cc0f5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#!/usr/bin/perl -w
use strict;
open(FH, $ARGV[0]);
my $search = $ARGV[1];
my $line;
my $is_indexed;
my $filename;
my @buf = ();
my $dump = 0;
while ( $line = <FH> ) {
chomp($line);
if ( $line =~ /^-----\ Begin chunk\ -----$/ ) {
$dump = 0;
@buf = ();
}
if ( $dump == 1 ) {
printf("%s\n", $line);
} elsif ( $dump == 0 ) {
push(@buf, $line);
}
if ( $line =~ /^Image\ filename: (.*)$/ ) {
$filename = $1;
if ( $filename eq $search ) {
while ( my $l = shift(@buf) ) {
printf("%s\n", $l);
}
$dump = 1;
} else {
$dump = -1;
}
}
if ( $line =~ /^-----\ End chunk\ -----$/ ) {
}
}
|