on *:TEXT:!del*:%m.channel:{
set %m.quitter $$1
;[color:green]Filter file.txt through the alias m.del[/color]
filter -fkn file.txt m.del *
;[color:green]If result file is as big as initial file, no entries were found![/color]
if $lines(file.txt) == $lines(file2.txt) { notice %m.quitter Didn't find an entry to erase. }
;[color:green]Else copy temp file to original[/color]
else { .copy -o file2.txt file.txt }
;[color:green]Cleanup: Unset the global var and delete temp file[/color]
unset %m.quitter
.remove file2.txt
}
alias m.del {
tokenize 32 $1
;[color:green]$1 is line number (due to -n filter switch)[/color]
if $4 != %m.quitter {
;[color:green]Entry doesn't match so write it to temp file[/color]
write file2.txt $2-
}
else {
;[color:green]Entry matches (You actually do nothing...)[/color]
echo 4 -s %m.quitter found on line: $1
notice %m.quitter Erased from list > $2-
echo -s Erased %m.quitter on request
}
}