Ivor O’Connor

May 18, 2012

Combining google voice address book with customer records making a master address book

Filed under: Uncategorized — ioconnor @ 8:03 pm

Parsing files from the command line today for a phone application.

grep -o '[0-9]\{3\}-[0-9]\{3\}-[0-9]\{4\}' customer*.* | sed 's/customer_//' | sed 's/.shtml:/ /' | sed 's/.php:/ /' | sed 's/.html:/ /' | sed 's/\(.*\) \(............\)/printf "+1\2 jb%04d\n" \1/' | sed -e 's/-//g' > /tmp/blah1
. /tmp/blah1 > /tmp/blah2

Leaves the customer phone number followed by their job number ready to be fed into the telephone database. Need to combine it with the google voice phone book though. So after exporting gv to contacts.csv…

grep “[0-9]\{6,12\}” contacts.csv | sed -e ‘s/Normal//’ | sed -e ‘s/My Contacts//’ | sed -e ‘s/DO NOT PICKUP;//’ | sed -e ‘s/;IgnoreTheseNumbers//’ | sed -e ‘s/Coworkers//’ | sed -e ‘s/;//g’ | sed -e ‘s/,,//g’ | sed -e ‘s/”Mobile Phone://’ | grep -e “+[0-9]\{5,20\}” | sed -e ‘s/\(.*\)\(+[0-9]*\)/\2: \1/’ | sed -e ‘s/,/ /g’ > /tmp/txt
and once inside /tmp/txt
:%s/\(+\d*: \)\(.*\)\(\n+\d*: \)\(“\)/\1\2\3\2/g
:%s/\(+\d*: \)\(.*\)\(\n+\d*: \)\(Mobile Phone:\)/\1\2\3\2/g
To get description on those lines that don’t have it

Then combine the files, put a comma at the end of each number and do:

sort -u -t, -k1,1 files > final


Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Blog at WordPress.com.

%d bloggers like this: