Creating an OPAC with grep

All of this library fun reminded me of my first foray into the world of PEI, libraries and the Internet.

When we first arrived in Prince Edward Island in the early 1990s, the Provincial Library was automated with a custom-designed, mainframe-based system. As any librarian who was there back in the day will attest, it was an evil beast of a system; if I recall correctly, for example, I don’t believe there was any way to search by author or title. I was once told the process for bringing a new book into the system: it involved a complicated set of operations, some of them in Charlottetown (where the mainframe was) and some of them in Morell (where the Provincial Library is headquartered; the victim of an since-aborted plan to decentralize government operations that also saw the road-sign shop move to Tignish and Vital Statistics to Montague).

Needless to say, the system was neither public (in the branches) nor online.

When I started working with the province on their website, I brought up the idea of making the library catalogue searchable on the provincial website, and by some miracle was able to convince the mainframe operators to export the entire list of holdings (about 400,000 records) as an ASCII text file. I use the word “export” here loosely, as the mainframe had no “export” feature per se and they actually had to “print to a file” to get me what I needed.

The state of Linux database technology at the time was very primitive — this was before MySQL, PostreSQL and the like. If you wanted to have a Linux-based webserver use databases, you had to roll your own (early versions of the Vistors Guide search, for example, used Berkeley DB and Perl.

As a result, making the library catalogue searchable required a hand-stitched system. What I ended up with was a Perl wrapper around grep, a general-purpose UNIX text search tool. Users would enter a keyword, we would grep the 400,000-line ASCII file, and display the results. Because the file was somewhat structured, we could even provide automatic hyperlinks to other works by the same author, other books on the same subject and so on.

I can’t recall how long this system was in place — it was eventually replaced by the current web-based OPAC with the Provincial Library converted to Dynix — but it fulfilled a useful role for a while. Those were the days.


Thom Hickey's picture
Thom Hickey on August 30, 2004 - 19:50 Permalink

You don’t mention the response time. We can grep WorldCat’s 50+ million records in about 2 seconds, making scans almost interactive.