#!/usr/bin/perl -w # # THIS SCRIPT CHANGES THE SECTION LABELLING # # example input name: sound-monitor or sound-monitor.sgml # example output name: sound-monitor.sgml.ug # $_ = shift @ARGV; s/.sgml//; $basename=$_; $infilename=$basename . ".sgml"; $outfilename=$basename . "-ug.sgml"; print ("Reading: $infilename\n"); open (IN,$infilename) || die "can't open file: $!"; print ("Writing: $outfilename\n"); open (OUT,">$outfilename") || die "can't open file for writing: $!"; while () { # Now comment out the license s// <\/sect1>/; # Start by substituting sections (sect4->sect5, sect3->sect4, ...) s/sect4/sect5/; s/sect3/sect4/; s/sect2/sect3/; s/sect1/sect2/; # Now try to pluck out any id's which could be problematic s/id="authors"/id="$basename-authors"/; s/id="bugs"/id="$basename-bugs"/; s/id="prefs"/id="$basename-prefs"/; s/id="usage"/id="$basename-usage"/; print OUT $_; } close (IN) || die "can't close $infilename: $!"; close (OUT) || die "can't close $outfilename: $!";