/ Published in: Perl
Name the source duplicate_remove.perl and open Terminal.app in the same directory, and write: perl duplicate_remove.perl
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/usr/bin/perl # Usage in command line: perl duplicate_remove.perl <file-to-be-convertet> # Remove duplicated lines in text-files my $origfile = $ARGV[0]; my $outfile = "no_duplicates_" . $origfile; my %hTmp; while (my $sLine = <IN>) { next if $sLine =~ m/^\s*$/; #remove empty lines #Without the above, still destroys empty lines except for the first one. } close OUT; close IN;