Linux, programming, computers and life

July 22, 2008

searching your organization address book from command line

Filed under: CLI, programming

Let’s assume that you are working in a relatively small organization, 4-5 hundreds people at most. I’m sure you have some kind of intranet and there’s a phone book there. I’m pretty sure you have a page with most used phone numbers pinned on your wall somewhere.
Here’s idea how to search those phones from command line. The solution is based on two scripts. First downloads the names list and formats it as necessary (mine strips all HTML mumbo-jumbo). This one is called periodically by cron. Second is used for names list search.

Here are the scripts:
update_tel_db
#! /bin/sh

cd /your/path/to/database
wget http://your.path.here/file.here >& /dev/null
touch tel.txt ; \rm tel.txt
links -dump file.here | grep @ | grep -v — ——————– | grep -v mailto | grep -vi ‘Click here’ | grep -v javascript | grep -v IMG | grep -v file: | tr ‘|’ ‘ ‘ | sed ’s/^ *//’ | sed ’s/ / /g’ | sed ’s/\[[0-9]*\]//g’ > tel.txt
\rm file.here >& /dev/null
touch tel.txt

tel
#! /bin/bash

echo ‘NAME DPT OFFICE CELL-PHONE HOME E-mail’
grep -i $1 /tour/path/here/tel.txt

Now telephone search becomes tel name on the command line.
Enjoy :)

Comments »

The URI to TrackBack this entry is: http://linux4all.blogsome.com/2008/07/22/searching-your-organization-address-book-from-command-line/trackback/

No comments yet.

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>



Anti-spam measure: please retype the above text into the box provided.

Get free blog up and running in minutes with Blogsome
Theme designed by Gary Rogers