[H-GEN] Reading Berkely DB files
Mark Suter
suter at zwitterion.humbug.org.au
Wed Apr 27 21:46:09 EDT 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
David,
> $ perl -T -w -e 'use strict; use GDBM_File;
> tie my %db, "GDBM_File", $ARGV[0], &GDBM_READER, 0600 or die "tie: $!\n";
> while (my ($key,$val) = each %db) {
> print "$key => $val\n";
> }
> untie %db' FILENAME
For fairness, here's an implemenation in python where the aydbm
module makes for better code.
python -c 'import sys, anydbm; dbm = anydbm.open(sys.argv[1], "r")
for key in dbm.keys(): print repr(key) + " => " + repr(dbm[key])
dbm.close()' FILENAME
Yours sincerely,
- -- Mark John Suter | I know that you believe you understand
suter at humbug.org.au | what you think I said, but I am not sure
gpg key id 2C71D63D | you realise that what you heard is not
mobile 0411 262 316 | what I meant. Robert J. McCloskey
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Check Keyservers or http://zwitterion.org/keys/
iD8DBQFCcEBhRYso2ixx1j0RAlZ5AJwPtMMDUXhOTCdZHH5kvqR2oYGe1ACfVIf1
gxHpd5qo0Phdfq2REdEB3p4=
=rKx7
-----END PGP SIGNATURE-----
More information about the General
mailing list