/ Published in: Perl
Name the source duplicateremove.perl and open Terminal.app in the same directory, and write: perl duplicateremove.perl
Expand |
Embed | Plain Text
#!/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; print "The file $origfile is convertet! Look for $outfile in the same directory";
You need to login to post a comment.
