diff options
author | wkj <devnull@localhost> | 2004-05-17 03:22:35 +0000 |
---|---|---|
committer | wkj <devnull@localhost> | 2004-05-17 03:22:35 +0000 |
commit | aa83d77271f0d2be72067058f78abd1780f3b69e (patch) | |
tree | 14a24e73abb43ad0b7340a1623e077a733b0be33 /src/cmd/index/doclean | |
parent | a7eb134e8717c2ea831066891314cf74fa4a6ad3 (diff) | |
download | plan9port-aa83d77271f0d2be72067058f78abd1780f3b69e.tar.gz plan9port-aa83d77271f0d2be72067058f78abd1780f3b69e.tar.bz2 plan9port-aa83d77271f0d2be72067058f78abd1780f3b69e.zip |
More troff bits; if you want them elsewhere, feel free to repo copy them.
Diffstat (limited to 'src/cmd/index/doclean')
-rw-r--r-- | src/cmd/index/doclean | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/cmd/index/doclean b/src/cmd/index/doclean new file mode 100644 index 00000000..c1763fd9 --- /dev/null +++ b/src/cmd/index/doclean @@ -0,0 +1,27 @@ +#!/bin/sh + +awk ' # doclean + +# Input: "number tab IX string +# 107 IX self-reference #1186 - +# 281 TL APPENDIX A AMPL Reference Manual #26 - +# Output: string (tab) number +# excess spaces are removed output string +# note reversal of order; rest of programs expect it + +# This contains some special pleading for the AMPL book + +BEGIN { FS = OFS = "\t" } + +/\t(TL|H1|H2|H3|LASTPAGE)/ { next } # zap expected noise + +$0 !~ /[0-9ixv]+\tIX / { + print "doclean: non index line: " $0 | "cat 1>&2"; next +} + +{ sub(/IX +/, "", $2) # zap "IX " + sub(/ +#[0-9]+ .*$/, "", $2) # zap trailing blanks, slug, file + gsub(/ +/, " ", $2) # compress internal blanks + print $2, $1 # item (tab) page number +} +' $* |