# 1193725.pl use strict; use warnings; use Path::Tiny qw/ path /; use List::Util qw/ uniq /; my $dir = '.'; my $iterator = path( $dir )->iterator; while( my $file = $iterator->() ) { next unless $file =~ /\.txt$/; my @lines = path( $file )->lines({ chomp => 1 }); path( $file )->spew( join "\n", uniq @lines ); } __END__
Hope this helps!
Update: Removed example output as it was distracting (after rereading question and amending example).
In reply to Re: parse multiple text files keep unique lines only
by 1nickt
in thread parse multiple text files keep unique lines only
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |