iHarder.net

ABFind

Support This Project

Search Your Address Book from the Command Line

Download v0.1 (35k)

ABFind is a Public Domain command-line tool that lets you search your Address Book. The formatting (at the moment) is just the default formatting that you get when you ask an ABPerson object for its description: [someone description].

Follow the file release RSS feed...

Installation

Copy the abfind file to someplace on your path like /usr/local/bin, or leave it in a "current directory," and call it with ./abfind instead. The abfind_10.4 file is for Mac OS X 10.4 (surprise). You can rename it as you like. Enjoy!

Usage

To find people with a word anywhere in their record just call abfind with the word following it:

$ abfind pat
Number of results: 12
******** id = 97A45DAA-322E-4895-8DBE-0AF07683E06C:ABPerson
ABPerson (0x10014b8b0) {
	ABPersonFlags : 0
	Address       : {
		*  home  {
    City = "Springfield";
... 
******** id = CE38FB5D-6C83-4D7C-A4A8-6B37FF7ABD91:ABPerson
ABPerson (0x100140f80) {
...

To see your own info use the -me switch:

$ abfind -me
******** id = 5447548F-60E9-4211-95BA-9348EC4733CF:ABPerson
ABPerson (0x100228590) {
	ABPersonFlags : 0
	Address       : {
		   work  {
    City = Springfield;
    State = ZZ;
    Street = "123 Main St";
    ZIP = 12345;
}
}
	Creation      : 2009-10-23 11:26:10 -0700
	Email         : {
		   work  john.doe@example.com
}
	First         : John
	Last          : Doe
	Modification  : 2009-10-23 11:26:47 -0700
	Phone         : {
		   work  800-555-1212
}
	Unique ID     : 5447548F-60E9-4211-95BA-9348EC4733CF:ABPerson
}

To find someone with "smith" in their name use the -name switch:

$ abfind -name smith
Number of results: 4
******** id = 06DD372E-B591-40D8-890F-395969586FE0:ABPerson
ABPerson (0x10013f150) {
	ABPersonFlags : 0
...
******** id = CE38FB5D-6C83-4D7C-A4A8-6B37FF7ABD91:ABPerson
ABPerson (0x100140f80) {
...

Typing abfind -? displays all the options:

$ abfind -?
USAGE: abfind [options] search
  Finds people in your address book.
  Version 0.1
  http://iHarder.net/abfind
EXAMPLE: abfind -name smith
  -name    Searches first and last name, case insensitive
  -fname   Searches first name, case insensitive
  -lname   Searches last name, case insensitive
  -city    Searches city, case insensitive
  -zip     Searches zip, case insensitive
  -note    Searches the note field, case insensitive
  -id      Searches for the exact person ID
  -me      Returns the person marked as 'me'. No search terms required.
  -?       This help
  If no options are given, all fields are searched.

Changes

A Note About Public Domain

I have released this software into the Public Domain. That means you can do whatever you want with it. Really. You don't have to match it up with any other open source license—just use it. You can rename the files, do whatever you want. If your lawyers say you have to have a license, contact me, and I'll make a special release to you under whatever reasonable license you desire: MIT, BSD, GPL, whatever.