#!/usr/bin/perl ############################################ # Splits HTML files to one <> tag per line # ############################################ # Copyright July 28, 2000 by Kevin Ehlers # ############################################ print "Enter the name of the file you wish to save to \(\"return\" to Quit\): "; $newfile=; exit if ($newfile =~ /^\s/); chomp($newfile); system('chmod 700 temp.tmp.stuff.crap'); #make sure file is writable open(TEMPFILE,">temp.tmp.stuff.crap") || die "$newfile could not be created/opened: $!"; system('chmod 700 temp.tmp.stuff.crap'); #make sure file is writable print "Enter the name of the html file to open \(\"return\" to Quit\): "; $file=; exit if ($file =~ /^\s/); chomp($file); open(OLDFILE,"$file") || die "$file doesn\'t exist: $!"; while () { s#<(.*?)>#\n<\1>\n#g; #make one <> tag per line while adding a crapload of blank lines print TEMPFILE; } close(OLDFILE); #no longer needed #no idea why I am doing this. Maybe it will work now??? close(TEMPFILE); #it works now, don't take these out or it will break the program open(TEMPFILE,"temp.tmp.stuff.crap"); open(NEWFILE,">$newfile") || die "Could not create $newfile: $!"; foreach () { unless (/^\s/) { #remove blanklines print NEWFILE; } } #funky close/open thing again close(TEMPFILE) || die "Unable to close temp: $!"; close(NEWFILE) || die "Not able to close $newfile: $!"; system('del temp.tmp.stuff.crap'); system('clear'); system('echo Done!');