Usage:
augprint [--target=realname] [--lens=Lensname] [--pretty] [--regexp[=n]] [--noseq] /path/filename
-t, --target ... use this as the filename in the output set-commands
this filename also implies the default lens to use
-l, --lens ... override the default lens and target and use this one
-p, --pretty ... make the output more readable
-r, --regexp ... use regexp() in path-expressions instead of absolute values
if followed by a number, this is the minimum length of the regexp to use
-s, --noseq ... use * instead of seq::* (useful for compatability with augeas < 1.13.0)
-h, --help ... this message
-V, --version ... print augeas version information and exit.
/path/filename ... full pathname to the file being analysed (required)
augprint will generate a script of augtool set-commands suitable for rebuilding the file specified
If --target is specified, then the lens associated with the target will be use to parse the file
If --lens is specified, then the given lens will be used, overriding the default, and --target
Examples:
augprint --target=/etc/squid/squid.conf /etc/squid/squid.conf.new
Output an augtool script for re-creating /etc/squid/squid.conf.new at /etc/squid/squid.conf
augprint --lens=simplelines /etc/hosts
Output an augtool script for /etc/hosts using the lens simplelines instead of the default for /etc/hosts
augprint --regexp=12 /etc/hosts
Use regular expressions in the resulting augtool script, each being at least 12 chars long
If the value is less than 12 chars, use the whole value in the expression
Regular expressions longer than 12 chars may be generated, if the 12 char regexp
would be match more than one value
Options (7)
| Option | Description | Source |
|---|
-t, --target targetfile | Generate the script for the FILE specified as if its path was really targetfile | help + man |
-l, --lens LENS | Use LENS for the given file; | help + man |
-p, --pretty | Create more readable output by adding spaces and empty lines | help + man |
-r, --regexp, -rN N | Generate regular expressions to match values, using a minumum length of N characters from the value | help + man |
-s, --noseq | Do not use "seq::" in the output, use "" instead. | help + man |
-h, --help | ... | help |
-v, --verbose | Include the original numbered paths as comments in the output (in the manual page but not in --help) | man |
Exit status (1) from the manual page
0 | the command was successful and 1 if any error occurred |
Examples (10) from the manual page, untested
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
These examples use the following /etc/hosts file as the FILE/files/etc/hosts
The output from "augtool 'print /files/etc/hosts'" would beset /files/etc/hosts/seq::*[ipaddr='127.0.0.1']/ipaddr '127.0.0.1'
"augprint /etc/hosts" /files/etc/hosts
"augprint --verbose /etc/hosts"set /files/etc/hosts/seq::*[ipaddr=~regexp('127\\..*')]/ipaddr '127.0.0.1'
"augprint --regexp=4 /etc/hosts"setm /augeas/load/*[incl='/etc/skel/.bashrc' and label() != 'shellvars']/excl '/etc/skel/.bashrc'
"augprint --lens shellvars /etc/skel/.bashrc"cp /etc/hosts ~
a) copy /etc/hosts to a new locationecho '192.0.2.7 defaultdns' >> ~/hosts
b) edit ~/hosts to suitaugprint --target /etc/hosts ~/hosts
c) Run "augprint" as followsset /files/etc/hosts/seq::*[ipaddr='192.0.2.7']/ipaddr '192.0.2.7'
d) Copy the relevant part of the output to an augtool script or other Augeas client
Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.