in reply to Re^2: parse multiple text files keep unique lines only
in thread parse multiple text files keep unique lines only

#!/usr/bin/perl # http://perlmonks.org/?node_id=1193719 use strict; use warnings; use File::Find; use Path::Tiny; my $directory = 'some/test/'; find sub { my %u; -f and /\.txt$/ and path($_)->edit_lines( sub { $_ x= !$u{$_}++ } ) }, $directory;

Replies are listed 'Best First'.
Re^4: parse multiple text files keep unique lines only
by tybalt89 (Monsignor) on Jul 01, 2017 at 02:53 UTC

    With Path::Tiny, you don't need File::Find.

    #!/usr/bin/perl # http://perlmonks.org/?node_id=1193719 use strict; use warnings; use Path::Tiny; my $directory = 'some/test/'; path($directory)->visit ( sub { my %u; -f and /\.txt$/ and $_->edit_lines ( sub { $_ x= !$u{$_}++ } ) } );