3.4 Listing the Entire File

The only argument cfpeek requires is the name of the file to parse. If no other arguments are given, it produces on the standard output a listing of that file in pathname-value form. Each simple statement in the input file is represented by a single line in the output listing. The line consists of two main parts: the full pathname of that statement and its value. The two parts are separated by a colon and space character. For example:

 
$ cfpeek sample.conf
.user: smith
.group: mail
.pidfile: /var/run/example
.logging.facility: daemon
.logging.tag: example
.program="a".command: a.out
.program="a".logging.facility: local0
.program="a".logging.tag: a
.program="b".command: b.out
.program="b".wait: yes
.program="b".pidfile: /var/run/b.pid

This output can be customized via the ‘--format’ (‘-H’) command line option. This option takes a list of output flags, each of which modifies some aspect of the output. Most output flags are boolean, i.e. they enable or disable the given feature. To disable the feature, the flag must be prefixed with ‘no’.

To list only the pathnames, use

 
$ cfpeek --format=path sample.conf
.user
.group
.pidfile
.logging.facility
.logging.tag
.program="a".command
.program="a".logging.facility
.program="a".logging.tag
.program="b".command
.program="b".wait
.program="b".pidfile

The default output is equivalent to ‘--format=path,value,descend’.

The flags ‘path’ and ‘value’ mean to print the pathname of the statement and its value. The ‘descend’ flag affects the output of compound nodes. If this flag is set and a node matching the key is a compound node, cfpeek will output this node and all nodes below it (i.e. its descendant nodes). The ‘descend’ flag is meaningful only if at least one lookup key is supplied.

You can also use ‘--format’ to change the default component delimiter. For example, to use slash to delimit components:

 
$ cfpeek --format=delim=/ sample.conf
/user: smith
/group: mail
/pidfile: /var/run/example
/logging/facility: daemon
/logging/tag: example
/program="a"/command: a.out
/program="a"/logging/facility: local0
/program="a"/logging/tag: a
/program="b"/command: b.out
/program="b"/wait: yes
/program="b"/pidfile: /var/run/b.pid