Okay, that Perl script I sent out yesterday doesn't deal with non-US
numbers. Jamie has them formatted differently than US-style numbers, so
they weren't being found when I parsed each phone entry.
Here is the corrected script with a slightly cleaner output:
----------
#!/usr/local/bin/perl
#Author: Jack Vinson: [EMAIL PROTECTED]
#Date: Tue Jun 28 1994
#Jack's attempt at parsing lisp objects via regexps in order to extract
# interesting info. In this case, I'm grabbing all the entries of the
# .bbdb file and displaying name and phone number if they exist.
#This can be fairly easily extended to display addresses as well.
#NOTE: The variable $nets will be filled improperly if the database
# entry has notes AND user-defined fields.
while (<>) {
($first, $last, $aliases, $company, $phones, $addresses, $nets, $other) =
/^\[(nil|\"[^\"]*\") (nil|\"[^\"]*\") (nil|\(\".*\"\)) (nil|\"[^\"]*\") (nil|\(.*\))
(nil|\(.*\)) (nil|\(\".*\"\)) (nil|.*) nil\]$/;
if ($first !~ /^nil$/) {
($temp1, $first, $temp2) = split(/\"/,$first,3);
}
if ($last !~ /^nil$/) {
($temp1, $last, $temp2) = split(/\"/,$last,3);
}
if ($phones =~ /^nil$/) {
print "There are no phone numbers available for $first $last.\n";
}
else {
@phentries = split(/\]/,$phones);
$phentries = @phentries;
if ($phentries > 2) { print "$first $last:\n"; }
else { print "$first $last:"; }
foreach $entry (@phentries) {
if ($entry !~ /\)$/) {
($temp1, $loc, $usnum, $nonusnum) = split(/\"/,$entry);
if ($usnum =~ /^\s*$/) {
$num = $nonusnum;
}
else {
@parts = split(/\s/,$usnum);
if ($parts[1] == "1") { shift(@parts); }
$num = "($parts[1]) $parts[2] $parts[3]";
}
printf("%10s: %-15s\n",$loc,$num);
}
}
print "\n";
}
}
--------------
Jonathan "Jack" Vinson [EMAIL PROTECTED]
WWW: "http://www.cis.upenn.edu/~vinson/home.html"
"Churchill was a shopping bag" - Fatima Mansions