User manual
#converts the names of the contacts to numbers so they can be read by
the voicemail software
`perl name2num.pl upload.csv`;
16.2.4 Number Insertion (insertnum.pl)
#!/usr/local/bin/perl
#inserts phone number into beginning of each line in csv file for upload
to database
if ($#ARGV != 1) {
print "Usage: insertnum.pl <csv-file> <phone-number>\n";
exit;
}
$number=$ARGV[1];
$csvfile=$ARGV[0];
open(FILE, "$csvfile") or die "Could not open file\n\n";
@lines = <FILE>;
#inserts number and quotations infront of each line
for $lines (@lines)
{
substr($lines, 0, 0) = $number . ",";
$lines =~ s/"//g;
#@split = split(/,/, $lines);
#$split[3] = "\u$split[3]");
#$lines = join(",",@split);
}
close FILE;
open(FILE, ">$csvfile") or die "Could not open file\n\n";
for $lines (@lines)
{
print FILE $lines;
}
close FILE;
16.2.5 sqlldr Control File (controlfile.ctl)
load data
infile upload.csv
replace
into table pb
fields terminated by ','
(usernum, entryNum FILLER, contactName, phone1 , phone2, phone3, phone4,
phone5, phone6, email1 FILLER , email2 FILLER , email3 FILLER , street
FILLER, postbox FILLER, city FILLER, state FILLER, zip FILLER, country
FILLER, memo FILLER)
16.2.6 Number Removal (rmnum.pl)
#!/usr/local/bin/perl
#removes numbers that were inserted earlier in the csv file
55