File: listremove

package info (click to toggle)
doc-linux-ja 2004.06.15-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 13,336 kB
  • ctags: 4
  • sloc: perl: 119; makefile: 79; sh: 15
file content (30 lines) | stat: -rw-r--r-- 530 bytes parent folder | download
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
#!/usr/bin/perl -w
#
# Copyright (c) 2002, 2003 GOTO Masanori <gotom@debian.org>
#
# Remove HOWTO section from INDEX-JF.html using brute force matching.
#
# usage: listremove <filename> <remove HOWTO name>

$filename = shift;
$howto = shift;

open(INPUTFILE, "< $filename") || die "can't open $filename!\n";
$status = 0;

while(<INPUTFILE>) {
	if ($status == 1) {
		if ($_ =~ /<\/DD>/) {
			$status = 0;
		}
	} else {
		if ($_ =~ /<DT><A\s*HREF="$howto.*">/) {
			$status = 1;
		} else {
			print $_;
		}
	}
}

close(INPUTFILE);