Skip to content

Instantly share code, notes, and snippets.

@JEEN
Created February 26, 2009 04:32
Show Gist options
  • Save JEEN/70655 to your computer and use it in GitHub Desktop.
Save JEEN/70655 to your computer and use it in GitHub Desktop.
use strict;
use warnings;
use File::Tail::Multi;
use Data::Dumper;
my $ft = File::Tail::Multi->new(
OutputPrefix => "f",
Files => [ "/home/leejj/*.pl" ],
Function => sub {
my $line = shift;
foreach my $data (@{ $line }) {
chomp $data;
my ($file, $text) = $data =~ /^([^:]+):(.+)$/;
print $file."\t".$text."\n";
}
},
NumLines => 5,
RemoveDuplicate => 0,
);
$ft->read;
__END__
result:
danga.pl );
danga.pl }
danga.pl );
danga.pl
danga.pl Danga::Socket->EventLoop;
file_tail.pl RemoveDuplicate => 0,
file_tail.pl );
file_tail.pl
file_tail.pl
file_tail.pl $ft->read;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment