Page is a not externally linkable
mathis - 9:31 pm on Jan 20, 2004 (gmt 0)
phonebook.txt has the following format: and number2name.pl looks like this: $infile = "phonebook.txt"; open(INPUT, $infile) ¦¦ die "Error opening $infile : $!\n"; while(<INPUT>) { __END__ my fli4l router/server does echo %d %t =\> `./number2name.pl %m`: `./number2name.pl %p` >> phonecalls.log where %d is date, %t is time, %m is the called number on my side (aka MSN) and %p is the calling phone number.
Hey guys, you finally made it! I would be lost without your help. I thought it would be nice to post the complete thing if someone stumbles on this page later...
012345824=Given Name Lastname
04385639=Name2 Whatever
...
[perl]
#!/usr/bin/perl -w
#
# this pgm looks for argument ($ARGV[0]) in file $infile
$pattern = $ARGV[0]; # some more checking of argument should be done in here
$found = 0;
if (/$pattern/) {
s/.*?=//;
print;
$found += 1;
exit; # put the exit here, if only the first match is required
}
}
if ($found == 0) {
print $pattern . "\n";
}
close(INPUT);
[/perl]
It works very fine with the tick-a-stat gnome panel applet which follows the log file...