Solved

Referring to the Parsing of Pim.vol file issue.

Posted on 2008-10-02
10
2,298 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
  • 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

776 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