The index program is a flexible database management program. index is pretty neat: it works by keeping two files for each database, a field description file and a file of sorted data. It's also fairly intuitive to use, once you get started.
To use index, you should first set up a database directory. By default, index looks for the directory $HOME/.index.
|index||Then when you start up index for the first time, you're asked to select a name for the database you want to use.|
Select a database:
If you specify the name of a database that doesn't exist yet, index assumes that you want to create it. index puts you in the editor specified in yourenvironment variable so you can list the titles for each field in the new database. Up to 16 fields can be supported. For example, you can create a database called addresses, defined to have the following fields:
NAME TITLE ORGANIZATION STREET ADDRESS CITY STATE ZIP CODE VOICE PHONE NUMBER FAX PHONE NUMBER EMAIL ADDRESS
After exiting the editor, you are put into the main menu:
Database: addresses (0 entries) a - Add new entry to database f - Find entry in database r - Read database entry by entry s - Save modifications, do not exit q - Save modifications, exit x - Exit Command:
There are no entries in the new database. You can start adding entries
now by pressing
When editing an entry in the database, you're prompted by each of the fields that were set up when the database was defined. After completing a field, press RETURN to get to the next field. There are also a limited number of escape sequences supported for editing and moving around - for example, CTRL-d to delete to the end of the line, or CTRL-p to move up a line. When you're done with the entire entry, press ESCAPE.
MomORGANIZATION: STREET ADDRESS:
2456 Bronx Park EastCITY:
10467VOICE PHONE NUMBER:
718-231-2618FAX PHONE NUMBER: EMAIL ADDRESS:
Once you've saved the new entry, you'll be back to the main menu. You can now add more entries, look at existing entries, search for a string in one of the existing entries, or exit.
To search for an existing entry, press
the main menu. You'll be asked for the search
Pattern to search for:
NAME: Benjamin Braddock TITLE: Sales Manager ORGANIZATION: Acme Plastics, Inc. STREET ADDRESS: 103 Morris St., Suite A CITY: Tucson STATE: AZ ZIP CODE: 85472 VOICE PHONE NUMBER: 800-998-9938 FAX PHONE NUMBER: 800-999-9999 EMAIL ADDRESS: email@example.com <RET> = next entry "d" = delete this entry "-" = previous entry "e" = edit this entry "q" = return to main menu Command:
index addresses '[bB]en'
All matching entries will be printed to standard output.
The most common use for a database like this is to maintain information about people. But you can use index to maintain all sorts of information. For example, you might keep one for information about local restaurants:
NAME: Rooster BBQ & Grill STREET ADDRESS: 1122 Rooster Ave. CITY: Cambridge PHONE: 555-1212 RESERVATIONS (y,n): n FOOD (1=poor, 10=excellent): 8 DECOR (1=poor, 10=excellent): 2 SERVICE (1=poor, 10=excellent): 6 RECOMMENDED DISHES: Baby-back ribs, Elvis pizza STAY AWAY FROM: Pulled turkey plate, mango pie RECOMMENDED BY: Jerry, Boston Phoenix