Solved

Referring to the Parsing of Pim.vol file issue.

Posted on 2008-10-02
10
2,310 Views
Last Modified: 2012-05-05
I was able to run the perl script, but notice numerous Argument "wait"  isn't numeric in numeric gt <>> at contact.pl line 16. Now  pim.vol contains contacts, calendar, etc, so maybe the contacts are th issue. just inquiring if anybody ran into this. Also how do you save the output to a file.
die "Usage: parse_Contact.pl pim.vol" unless $ARGV[0];
 
print "Start parsing..\n";
 
my $cond = "wait";
my $contact = '';
my %contacts;
 
open(F, "<".$ARGV[0] );
 
my $s;
while(read(F, $s, 1) ) {
 
  while($s =~ /./g) {
    if( ord($s) == 8 && $cond eq "wait" ) {
      $cond = "zero";
    } elsif ( ord($s) == 0 && $cond eq "zero" ) {
      $cond = "start";
    } elsif ( $cond eq "zero" ) {
      $cond = "wait";
    } elsif ( ( $cond =~ /^start|read$/ || ( $cond > 0 && $cond < 6 )) && ( ( ord($s) >= 48 && ord($s) <= 57 ) || ( ord($s) >= 97 && ord($s) <= 122 ) || ( ord($s) >= 65 && ord($s) <= 90 ) || ord($s) == 32 ) ) {
      $contact =~ /(.)$/;
      if( ( ord($1) < 48 || ord($1) > 57 ) && ( ord($s) >= 48 && ord($s) <= 57 ) ) {
        $contact .= ';';
      }
      $contact .= $s;
      $cond = "read";
    } elsif ( $cond eq 'read' ) {
      $cond = 1;
    } elsif ( $cond >= 4 ) {
      $cond = "wait";
      $contacts{$contact} = 1 if $contact =~ /\d{5,}/ && $contact =~ /\w+/;
      $contact = '';
    } elsif ( $cond > 0) {
      $cond++;
    }
  }
}
 
close(F);
 
for my $contact (sort keys %contacts) {
  print $contact."\n";
  
}

Open in new window

0
Comment
Question by:Med123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 3
10 Comments
 
LVL 39

Accepted Solution

by:
Adam314 earned 340 total points
ID: 22629038
Line 16 in what you posted does not look to be where the error is coming from.  Post the entire script.

To save to a file, add this to the end of your command:   > file.txt
eg: parse_Contact.pl pim.vol > file.txt
0
 
LVL 84

Assisted Solution

by:ozo
ozo earned 160 total points
ID: 22632548
perl -Mdiagnostics  -we '$cond = "wait"; if( $cond > 0 ){}'
Argument "wait" isn't numeric in numeric gt (>) at -e line 1 (#1)
    (W numeric) The indicated string was fed as an argument to an operator
    that expected a numeric value instead.  If you're fortunate the message
    will identify which operator was so unfortunate.


what are you trying to do?
did you mean to use a string compare gt instead of a numeric compare >
0
 

Author Comment

by:Med123
ID: 22633774
I was just trying extract the contact information out of the PIM.VOL. My wife's cell phone kind of crash and it won't let her access the contacts or Calendar. I care more about the contacts because she has been adding new ones for a few months now and we couldn't get the phone to sync with her PC. So I was able to beam the PIM.Vol file to my PC. I took this PERL script from another users on the Exhange who was experiencing the same issue. I just modified the parse_ to my file name Contact.  Also did anybody ever figure out a way to better format the data that gets extracted. Also that snipplet of code was the whole script. I think the post was closed, but I was just wondering.
Contact.txt
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 39

Assisted Solution

by:Adam314
Adam314 earned 340 total points
ID: 22634206
I'm guessing this is because either your pim.vol file is different from the format the script was designed for, or this is a bug in the script.

0
 

Author Comment

by:Med123
ID: 22634556
You're probably right. Hey did anybody have any Code Snippet I could use beside this one for extracting data from the Pim.vol file? or even another suggestion on how to browse/read a pim.vol file?  I'm running out of ideas.
0
 
LVL 39

Assisted Solution

by:Adam314
Adam314 earned 340 total points
ID: 22635150
Depending on how dead the phone is, and what model, you might be able to use BitPim to get the data:
    http://www.bitpim.org/
0
 

Author Comment

by:Med123
ID: 22635216
It's an AllTell  HTC Touch phone. any Ideas on that one?  Thanks for the other tip.
0
 
LVL 39

Assisted Solution

by:Adam314
Adam314 earned 340 total points
ID: 22635838
You could try going to an AllTell retailer, and see if they have any equipment/software that will help.  Or contact  AllTell and/or HTC customer service, and see if they have any suggestions.

I don't know of anything that works with that phone though.
0
 
LVL 84

Assisted Solution

by:ozo
ozo earned 160 total points
ID: 22637674
if you don't mind treating "wait" as 0 in numeric comparisons, and you are not worried about catching other problems in the script, you might just turn off warnings by setting
no warnings;
0
 
LVL 84

Assisted Solution

by:ozo
ozo earned 160 total points
ID: 22637709
#or
no warnings "numeric";
#you can also turn them off just in the block in which you do the compare
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question