Install the required Perl modules

yum install db4.i386 db4-devel.i386

Write the Perl code:

#!/usr/bin/perl
use BerkeleyDB;
tie %hash, 'BerkeleyDB::Hash', -Filename => $ARGV[0]
or die "can't read file '$ARGV[0]': $!";
print map { "  $_ => $hash{$_}\n" } sort keys %hash;

Use on a Sendmail .db file


$ perl reader.pl /etc/mail/access.db
127.0.0.1 => RELAY
86.169.227.158 => RELAY
localhost => RELAY
localhost.localdomain => RELAY