Main Page
Main page
About Me
Software I wrote
Resume
Friends of mine
Pictures
Musicianship
Stuff I have for sale
Personal News
2010:
March ,
April .
2009:
January ,
March ,
August .
2008:
Jan ,
Feb ,
Apr ,
May ,
July ,
August ,
September ,
October .
2007:
Jan ,
Feb ,
Mar ,
Apr ,
May ,
Jun ,
Jul ,
Aug ,
Sep ,
Oct ,
Nov ,
Dec .
2006:
Jan ,
Feb ,
Mar ,
Apr ,
Jun ,
Jul ,
Aug ,
Sep ,
Oct ,
Nov ,
Dec .
2005:
Jan ,
Feb ,
Mar ,
Apr ,
May ,
Jun ,
Jul ,
Aug ,
Sep ,
Oct ,
Nov ,
Dec .
2004:
Jan ,
Feb ,
Mar ,
Apr ,
May ,
Jun ,
Jul ,
Aug ,
Sep ,
Oct ,
Nov ,
Dec .
2003:
Jan ,
Feb ,
Mar ,
Apr ,
May ,
Jun ,
Jul ,
Aug ,
Sep ,
Oct ,
Nov ,
Dec .
2002:
Feb ,
Mar ,
Apr ,
May ,
Jun ,
Jul ,
Aug ,
Sep ,
Oct ,
Nov ,
Dec .
2001:
Jan ,
Feb ,
Mar ,
Apr ,
May ,
Jun ,
Jul ,
Aug ,
Sep ,
Oct ,
Nov ,
Dec .
2000:
Jan ,
Feb ,
Apr ,
May ,
Jun ,
Jul ,
Aug ,
Oct ,
Nov ,
Dec .
1999:
Jan ,
Feb ,
Jun ,
Oct ,
Dec .
1998:
Jul ,
Aug ,
Sep ,
Nov .
Geek Stuff (computer related)
Digital Music
Java
Why LiveWire Sucks
Why ASP Sucks (a bit)
Linux
MacOS
Unix
Oracle
Perl
Emacs
O'Reilly
(some of) My Interests
Humor
Sony Playstation
Cars
Search
Ads
This is a handly lttle Perl script which I hacked up to help me read the various DBM-based password and user info database files which we use for sites which are not big enough to justify the use of a SQL database.
The -c option chops off trailing newlines from the key, and removes null characters from the output, which is necessary in some cases, when the DBM was created by a C program.
#!/usr/local/bin/perl
if (dbmopen(%DBMFILE, $ARGV[0],0444))
{
@the_keys=keys(%DBMFILE);
foreach $entry (@the_keys)
{
if ($ARGV[1] == '-c')
{
$chopped_entry=$entry;
chomp($chopped_entry);
$chopped_entry =~ s/\000//g;
$chopped_value = $DBMFILE{$entry};
chomp ($chopped_value);
$chopped_value =~ s/\000//g;
print '['.$chopped_entry.'] '.$chopped_value."\n";
}
else
{
print '['.$entry.'] '.$DBMFILE{$entry}."\n";
}
}
dbmclose(%DBMFILE);
}
else
{
print "Doh!\n\n";
}
exit ;