Advertisement
baptx

contacts_extractor

Sep 18th, 2012
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.51 KB | None | 0 0
  1. # Create a readable summary of your VCF contacts file
  2. # (extracts contact name and phone number only)
  3.  
  4. my $input = "contacts.vcf";
  5. my $output = "contacts_summary.txt";
  6.  
  7. open(input, "<", $input)
  8.     or die "Cannot open input file $input $!\n";
  9. open(output, ">", $output)
  10.     or die "Cannot open output file $output $!\n";
  11.  
  12. my @lines, $linecut;
  13.  
  14. @lines = <input>;
  15.  
  16. for($i = 1; $i < @lines.length; $i++) {
  17.     $linecut = @lines[$i];
  18.     if($linecut =~ /^(N:|TEL;)/) {print output $linecut};
  19. }
  20.  
  21. print "Complete!\n"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement