Discovering hidden utilities in Solaris: makedbm and makemap

While blogging on the dbm theme, I had always used a PERL one-liner to dump the contents of my dbm databases.
dbmopen(%D,$ARGV[0],0444);for(keys %D){print "$_ $D{$_}\\n"}
Scripting languages like PERL make it really easy to write "your own", rather than try to find "some other tool" that does the work. It is perhaps faster to write your own.

However, let us see if there is anything readily available in Solaris that dumps the contents of a dbm file. If there is such a command, it might use dbm_open(3C). So we search for it in the source browser. The makedbm.c looks promising and see that it has a function unmake() which is clearly reading keys and values from a given dbm database. Even though the command name sounds like it is a tool to create dbm files, its manpage says it can also dump the contents of a dbm file with option -u. (while not very intuitive, think of -u as adding a negative i.e "not makedbm")

So makedbm -u filename (without the .pag or .dir prefix) is your friend if you want to see whats in a dbm file. makedbm is part of Solaris yp/NIS naming toolchest. It has a cousin in sendmail space too (makemap -u dbm filename)
Comments:

Post a Comment:
Comments are closed for this entry.
About


sayings of an hearer

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today