blob: abf0dc7936d6750b548f2fa6d5c5a983aabeeaaa (
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
|
#! /usr/bin/env perl
$key = "c";
$select = 1;
# Read switches.
while ( $_ = $ARGV[0], /^-/ ) {
shift;
last if /^--$/;
if ( /^-f/ ) { $key = "f" };
}
# Read input lines.
line: while (<>) {
# Detect start of prologue and initialise prologue text.
if ( /^[fc]\+ *$/ ) {
$select = 0;
if ( /^$key\+ *$/o ) { $select = 1; }
next line;
}
# Detect end of prologue.
if ( /^[fc]- *$/ ) { $select = 1; next line }
# Process the prologue contents.
if ( $select ) { print; }
}
|