Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Migrate contacts from Verizon phone to iPhone' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Migrate contacts from Verizon phone to iPhone
Authored by: robleach on Jul 10, '09 11:40:14AM
OK. I have worked it out. This command line grep and perl script will convert the html file to a tab delimited file in one shot. Note that it Verizon ever changes their HTML code, this will no longer work correctly. This will output headers on the first line:
grep -E "name more|Mobile|Work|Home|Fax|mailto" vzaddressbookbackup20090710.html | perl -e 'while(<>){if(/^.*name more[^>]+>([^<]+)/){$name=$1}elsif(m%>([^<]+)</strong>(?:<a[^>]+>)?([^<]+)%){$g->{$1}=1;$h->{$name}->{$1}=$2}}print("Namet",join("t",keys(%$g)),"n");foreach my $name (sort {$a cmp $b} keys(%$h)){print("$namet",join("t",map {exists($h->{$name}->{$_}) ? $h->{$name}->{$_} : ""} keys(%$g)),"n")}' > vzaddressbookbackup20090710.tab
Note, you will have to put your input and output file names where bolded. Rob

[ Reply to This | # ]