masked special characters only for searchstring and not for outputs
This commit is contained in:
parent
38252cc554
commit
d45663caaa
3 changed files with 24 additions and 21 deletions
13
firstseen.pl
13
firstseen.pl
|
@ -9,9 +9,10 @@ if ($#ARGV ne 2){
|
|||
my $chan=$ARGV[1];
|
||||
my $folder=$ARGV[0];
|
||||
my $nick=$ARGV[2];
|
||||
$nick=~s/\\/\\\\/g;
|
||||
$nick=~s/\|/\\\|/g;
|
||||
$nick=~s/\^/\\\^/g;
|
||||
my $snick=$nick;
|
||||
$snick=~s/\\/\\\\/g;
|
||||
$snick=~s/\|/\\\|/g;
|
||||
$snick=~s/\^/\\\^/g;
|
||||
|
||||
my @files;
|
||||
|
||||
|
@ -24,7 +25,7 @@ my $line;
|
|||
|
||||
open(file, $file) or die("Could not open file $file");
|
||||
foreach $line (<file>) {
|
||||
if ($line =~ m/^\[[0-9]{2}:[0-9]{2}(:[0-9]{2})?\] (Action: )?<?$nick>? /i) {
|
||||
if ($line =~ m/^\[[0-9]{2}:[0-9]{2}(:[0-9]{2})?\] (Action: )?<?$snick>? /i) {
|
||||
if ($date =~ /^irgendwas$/) {
|
||||
print "$nick belongs to inventory\n";
|
||||
exit 0;
|
||||
|
@ -37,8 +38,8 @@ foreach $line (<file>) {
|
|||
if ($line =~ m/^\[00:00(:00)?\] --- /){
|
||||
($date=$line)=~s/^\[00:00(:00)?\] --- (.*)\n/$2/;
|
||||
}
|
||||
if ($line =~ m/^\[[0-9]{2}:[0-9]{2}(:[0-]{2})?\] Nick change: .* -> $nick/i) {
|
||||
($newnick=$line)=~s/.* Nick change: (.*) -> $nick\n/$1/i;
|
||||
if ($line =~ m/^\[[0-9]{2}:[0-9]{2}(:[0-]{2})?\] Nick change: .* -> $snick/i) {
|
||||
($newnick=$line)=~s/.* Nick change: (.*) -> $snick\n/$1/i;
|
||||
print "$nick was $newnick\n";
|
||||
exec($^X, $0, $folder, $chan, $newnick);
|
||||
exit 0
|
||||
|
|
23
lastseen.pl
23
lastseen.pl
|
@ -10,9 +10,10 @@ if ($#ARGV ne 2){
|
|||
my $chan=$ARGV[1];
|
||||
my $folder=$ARGV[0];
|
||||
my $nick=$ARGV[2];
|
||||
$nick=~s/\\/\\\\/g;
|
||||
$nick=~s/\|/\\\|/g;
|
||||
$nick=~s/\^/\\\^/g;
|
||||
my $snick=$nick;
|
||||
$snick=~s/\\/\\\\/g;
|
||||
$snick=~s/\|/\\\|/g;
|
||||
$snick=~s/\^/\\\^/g;
|
||||
|
||||
my @files;
|
||||
|
||||
|
@ -31,7 +32,7 @@ my $log = File::ReadBackwards->new($file) || die $!;
|
|||
while ($line=$log->readline()){
|
||||
# $line=$log->readline();
|
||||
if ($date eq 0){
|
||||
if ($line =~ m/^\[[0-9]{2}:[0-9]{2}(:[0-9]{2})?\]( Nick change:)? $nick /i && $line !~ m/joined #/ ) {
|
||||
if ($line =~ m/^\[[0-9]{2}:[0-9]{2}(:[0-9]{2})?\]( Nick change:)? $snick /i && $line !~ m/joined #/ ) {
|
||||
$date=1;
|
||||
$lastaction=$line;
|
||||
}
|
||||
|
@ -39,23 +40,23 @@ while ($line=$log->readline()){
|
|||
if ($line =~ m/^\[00:00(:00)?\] --- /){
|
||||
($date=$line)=~s/^\[00:00(:00)?\] --- (.*)\n/$2/;
|
||||
($time=$lastaction)=~s/(.*)\[([0-9]{2}:[0-9]{2}(:[0-9]{2})?)\](.*)\n/$2/;
|
||||
$l=9+length($nick);
|
||||
$k=12+length($nick);
|
||||
$l=9+length($snick);
|
||||
$k=12+length($snick);
|
||||
if ($lastaction=~m/^.{$l}kicked/ || $lastaction=~m/.{$k}kicked/){
|
||||
($by=$lastaction)=~s/^\[[0-9]{2}:[0-9]{2}(:[0-9]{2})?\] $nick kicked from #.* by //i;
|
||||
($by=$lastaction)=~s/^\[[0-9]{2}:[0-9]{2}(:[0-9]{2})?\] $snick kicked from #.* by //i;
|
||||
($reason=$by)=~s/.*: (.*)\n/$1/;
|
||||
$by=~s/:.*\n//i;
|
||||
|
||||
print "$nick was kicked by $by on $date at $time reason: $reason\n";
|
||||
} elsif ($lastaction=~m/$nick \(.*\) left irc: /i){
|
||||
($message=$lastaction)=~s/^.* $nick \(.*\) left irc: (.*)\n/$1/i;
|
||||
} elsif ($lastaction=~m/$snick \(.*\) left irc: /i){
|
||||
($message=$lastaction)=~s/^.* $snick \(.*\) left irc: (.*)\n/$1/i;
|
||||
print "$nick has quit on $date at $time saying: $message\n";
|
||||
} elsif ($lastaction=~m/Nick change: $nick /i) {
|
||||
($newnick=$lastaction)=~s/^.*Nick change: $nick -> (.*)\n/$1/i;
|
||||
($newnick=$lastaction)=~s/^.*Nick change: $snick -> (.*)\n/$1/i;
|
||||
print "$nick changed his name to $newnick on $date at $time\n";
|
||||
} else {
|
||||
if ($lastaction=~m/\)\.$/) {
|
||||
($message=$lastaction)=~s/^.* $nick \(.*\) left #[a-zA-Z0-9]* \((.*)\)\.\n/$1/i;
|
||||
($message=$lastaction)=~s/^.* $snick \(.*\) left #[a-zA-Z0-9]* \((.*)\)\.\n/$1/i;
|
||||
print "$nick has left on $date at $time saying: $message\n";
|
||||
} else {
|
||||
print "$nick has left on $date at $time\n";
|
||||
|
|
|
@ -10,9 +10,10 @@ if ($#ARGV ne 2){
|
|||
my $folder=$ARGV[0];
|
||||
my $chan=$ARGV[1];
|
||||
my $nick=$ARGV[2];
|
||||
$nick=~s/\\/\\\\/g;
|
||||
$nick=~s/\|/\\\|/g;
|
||||
$nick=~s/\^/\\\^/g;
|
||||
my $snick=$nick;
|
||||
$snick=~s/\\/\\\\/g;
|
||||
$snick=~s/\|/\\\|/g;
|
||||
$snick=~s/\^/\\\^/g;
|
||||
|
||||
my @files;
|
||||
|
||||
|
@ -32,7 +33,7 @@ my $log = File::ReadBackwards->new($file) || die $!;
|
|||
while ($line=$log->readline()){
|
||||
# $line=$log->readline();
|
||||
if ($date eq 0){
|
||||
if ($line =~ m/^\[[0-9]{2}:[0-9]{2}(:[0-9]{2})?\] <$nick> /i && $line !~ m/joined #/ ) {
|
||||
if ($line =~ m/^\[[0-9]{2}:[0-9]{2}(:[0-9]{2})?\] <$snick> /i && $line !~ m/joined #/ ) {
|
||||
$date=1;
|
||||
($lastaction=$line)=~s/\n//;
|
||||
} elsif ($line =~ m/^\[00:00(:00)?\] --- /) {
|
||||
|
|
Loading…
Reference in a new issue