Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- my $inputfile = @ARGV[0];
- my @out;
- my $linecounter=0;
- print "Cleaning HTML entities from $inputfile...\n";
- open (FILETOCLEAN, $inputfile) or die "Cannot open $inputfile: $!\n";
- while (<FILETOCLEAN>) {
- chomp; #grab a line
- $out[$linecounter] = $_;
- $out[$linecounter] =~ s/</</g;
- $out[$linecounter] =~ s/>/>/g;
- $out[$linecounter] =~ s/"/"/g;
- ++$linecounter;
- }
- close (FILETOCLEAN); #close the file
- my $outputfile;
- $outputfile=$inputfile;
- open (CLEANFILE, ">$outputfile");
- foreach my $line (@out) {
- print CLEANFILE "$line\n";
- ++$linecounter;
- }
- print "Cleaned $inputfile.\n";
- close (CLEANFILE);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement