#!/usr/local/bin/perl -s # # tagstrip.pl # # Strip tags from HTML file # # Be carefull since that script is not fully working # with recursive # It's still a usefull to me :-) # Run "program -h" to see the run options # # Last modified: 04/06/1999 # Author: Stas Bekman # Diagnostic part... if ($#ARGV<0 || $h) { die "\nUsage: \t tagstrip.pl [-options] original_file(s) options: -h you read me now -no_bak Don't backup the original file -no_glob If you want to replace only first occurence in each line\n"; } #slurp it ALL into $_ undef $/; while (<>){ if ($ARGV ne $oldargv){ if (!$no_bak) {rename($ARGV, $ARGV . '.bak');} open (ARGVOUT, ">$ARGV") || die "Can't open $ARGV[0]: $!\n"; select(ARGVOUT); $oldargv= $ARGV; } if ($no_glob) {s/<[^>]*/ /s;} else {s/<[^>]*>/ /sg;} } continue { print; # this prints to the original filename } close(ARGVOUT); select(STDOUT);