#!/usr/bin/python import sys import anydbm def prefix(string, max_len): if string[max_len:]: return string[:max_len] + '...' else: return string def display(key, value): sys.stdout.write('-> %-20s %s\n' % (prefix(key, 20), prefix(value, 1000))) def main(): for filename in sys.argv[1:]: try: db = anydbm.open(filename, 'r') except anydbm.error: sys.stderr.write('Error opening %s - continuing\n' % filename) continue for key in db.keys(): value = db[key] display(key, value) db.close() main()