javaproperties
NAME
javaproperties — Basic manipulation of Java .properties files
SYNOPSIS
javaproperties get [<options>] <file> <key> ...
javaproperties select [<options>] <file> <key> ...
javaproperties set [<options>] <file> <key> <value>
javaproperties delete [<options>] <file> <key> ...
javaproperties format [<options>] [<file>]
get
javaproperties get [<options>] <file> <key> ...
Print out the values of the given keys in the given .properties file. Each
value is printed out on a separate line with escape sequences interpolated.
If you want the output to also be in .properties format, see select.
Options
- -d VALUE, --default-value VALUE
Default value for undefined keys. If this option is not specified, keys requested on the command line that are not defined in either the main
.propertiesfile or the--defaultsfile will (unless the--quietoption is given) cause a warning to be printed to stderr and the command to exit with a failure status.
- -D FILE, --defaults FILE
.propertiesfile of default values. If this option is specified, keys requested on the command line that are not defined in the main.propertiesfile will be looked up in this file.
- -e, --escaped
Parse the keys and default value specified on the command line for
.properties-style escape sequences (specifically, those supported byjavaproperties.unescape)
- -E ENCODING, --encoding ENCODING
Specifies the encoding of the input file(s); default value:
iso-8859-1(a.k.a. Latin-1). Output always uses the locale’s encoding.
- -q, --quiet
Added in version 0.7.0.
Do not warn about or fail due to missing keys
select
javaproperties select [<options>] <file> <key> ...
Print out the key-value entries in the given .properties file for the given
keys. The output is in .properties format, reformatted as though by
format.
Options
- -A, --ascii
Added in version 0.6.0.
Escape all non-ASCII characters in the output with
\uXXXXescape sequences. This overrides--unicode. This is the default behavior.
- -d VALUE, --default-value VALUE
Default value for undefined keys. If this option is not specified, keys requested on the command line that are not defined in either the main
.propertiesfile or the--defaultsfile will (unless the--quietoption is given) cause a warning to be printed to stderr and the command to exit with a failure status.
- -D FILE, --defaults FILE
.propertiesfile of default values. If this option is specified, keys requested on the command line that are not defined in the main.propertiesfile will be looked up in this file.
- -e, --escaped
Parse the keys and default value specified on the command line for
.properties-style escape sequences (specifically, those supported byjavaproperties.unescape)
- -E ENCODING, --encoding ENCODING
Specifies the encoding of the input and output files; default value:
iso-8859-1(a.k.a. Latin-1)
- -o FILE, --outfile FILE
Write output to this file instead of standard output
- -s SEP, --separator SEP
Use
SEPas the key-value separator in the output; default value:=
- -q, --quiet
Added in version 0.7.0.
Do not warn about or fail due to missing keys
set
javaproperties set [<options>] <file> <key> <value>
Set the value of <key> in the .properties file <file> to
<value> and output the results. The other entries in the file (including
comments, possibly not including the timestamp; see below) will be left as-is.
Options
- -A, --ascii
Added in version 0.6.0.
Escape all non-ASCII characters in the new key & value with
\uXXXXescape sequences on output. This overrides--unicode. This is the default behavior.
- -e, --escaped
Parse
<key>and<value>for.properties-style escape sequences (specifically, those supported byjavaproperties.unescape)
- -E ENCODING, --encoding ENCODING
Specifies the encoding of the input and output files; default value:
iso-8859-1(a.k.a. Latin-1)
- -o FILE, --outfile FILE
Write output to this file instead of standard output
- -s SEP, --separator SEP
Separate
<key>and<value>in the output withSEP; default value:=
- -T, --preserve-timestamp
Do not modify the timestamp in the
.propertiesfile. By default, if a timestamp is found, it is updated to the current time, even if the rest of the file is unchanged.
delete
javaproperties delete [<options>] <file> <key> ...
Remove all entries for the given keys from the given .properties file and
output the results. The other entries in the file (including comments,
possibly not including the timestamp; see below) will be left as-is.
Options
- -e, --escaped
Parse the keys specified on the command line for
.properties-style escape sequences (specifically, those supported byjavaproperties.unescape)
- -E ENCODING, --encoding ENCODING
Specifies the encoding of the input and output files; default value:
iso-8859-1(a.k.a. Latin-1)
- -o FILE, --outfile FILE
Write output to this file instead of standard output
- -T, --preserve-timestamp
Do not modify the timestamp in the
.propertiesfile. By default, if a timestamp is found, it is updated to the current time, even if the rest of the file is unchanged.
format
javaproperties format [<options>] [<file>]
Normalize the formatting of the given .properties file (or standard input
if no file is given) and output the results. All comments, excess whitespace,
invalid escapes, and duplicate keys are removed, and the entries are sorted
lexicographically.
Options
- -A, --ascii
Added in version 0.6.0.
Escape all non-ASCII characters in the output with
\uXXXXescape sequences. This overrides--unicode. This is the default behavior.
- -E ENCODING, --encoding ENCODING
Specifies the encoding of the input and output files; default value:
iso-8859-1(a.k.a. Latin-1)
- -o FILE, --outfile FILE
Write output to this file instead of standard output
- -s SEP, --separator SEP
Use
<sep>as the key-value separator in the output; default value:=