-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathparseContacts.pl
More file actions
executable file
·41 lines (37 loc) · 871 Bytes
/
parseContacts.pl
File metadata and controls
executable file
·41 lines (37 loc) · 871 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/perl
# Script: parseContacts.pl
# Description: Parse Google Contacts csv file
# Author: Steven Ahrendt
# email: sahrendt0@gmail.com
# Date: 01.21.2014
##################################
use warnings;
use strict;
use Getopt::Long;
#####-----Global Variables-----#####
my $input;
my ($help,$verb);
GetOptions ('i|input=s' => \$input,
'h|help' => \$help,
'v|verbose' => \$verb);
my $usage = "Usage: parseContacts.pl -i input\n";
die $usage if $help;
die "No input.\n$usage" if (!$input);
#####-----Main-----#####
open(IN,"<$input");
while(my $line = <IN>)
{
chomp $line;
my @data = split(/,/,$line);
#1,3,18-24 googleContacts.csv
print "$data[0] $data[2]\t";
for(my $i = 17; $i < 24; $i++)
{
print "$data[$i]\t" if ($data[$i]);
}
print "\n";
}
close(IN);
warn "Done.\n";
exit(0);
#####-----Subroutines-----#####