aboutsummaryrefslogtreecommitdiff
path: root/scripts/find-filename
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/find-filename')
-rwxr-xr-xscripts/find-filename45
1 files changed, 45 insertions, 0 deletions
diff --git a/scripts/find-filename b/scripts/find-filename
new file mode 100755
index 00000000..c9b09680
--- /dev/null
+++ b/scripts/find-filename
@@ -0,0 +1,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\ -----$/ ) {
+
+ }
+
+}