Many programs keep their configurations in files with hierarchical structure. Such files normally define sections, which keep logically separated blocks of statements. These statements may in turn contain subsections, and so on. On the lowest level of hierarchy are simple statements, which normally define some basic configuration settings.
Some of the packages which use structured configurations are: BIND, GNU Dico, GNU Mailutils, git. Of course, their configuration files differ in syntax, but the principle remains the same.
Cfpeek provides a uniform and consistent command line interface for various operations on such files.
It can be used to list them in a uniform output format; to look up and retrieve configuration values, both by literal keyword matches and by using wildcard patterns, to reformat the files in arbitrary way, and to apply external scripts to statements from the file.
To put it another way, cfpeek is for structured configuration files what grep and awk are for line-oriented ones.
Cfpeek operates on a wide variety of configuration formats: native Grecs format, the pathname-value or X-resource format files, BIND configuration files, MeTA1 and Git-format files.
As an example of its possibilities, the following cfpeek invocation outputs names of all master zones from the /etc/named.conf file:
$ cfpeek --format=up=1,nodescend,value --parser=bind /etc/named.conf '.*.type=master'
The functionality provided by the program can be extended using Guile scripts.
The package is built on the Grecs parser library.