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
|
#! /usr/bin/perl -w
# A simple, not very flexible bit of Perl to extract the sample code
# from the User Guide.
while(<>) {
last if /chapter id="programming"/;
}
while(<>) {
if (/<programlisting/) {
$C = 1;
next;
}
$C = 0 if /\/programlisting/;
last if /chapter id="acknowledgments"/;
next unless $C;
s/<!\[CDATA\[|\]\]\>//;
s/<lineannotation>.+$//;
s/<co id.+$//;
s/</</g;
s/>/>/g;
print;
}
__DATA__
$Id: grep_sample_code,v 1.1 2007-12-10 05:13:11 jklowden Exp $
|