Or if you really want to get fancy, you could integrate a sqlite3 (which is what Apple uses, so it ships on every Mac) database directly into Keyboard Maestro. A couple years back I wrote a long series of articles on how to do just that:
The initial learning curve is steep (quite steep, to be honest), but once you have it worked out, you can do a lot with databases integrated directly into your macros.
One of my macros that uses an integrated sqlite3 database is Quick Web Search, which I use dozens of times a day.
-rob.