Sort a Splunk .conf file. Sort has two modes: (1) by default, the sorted
config file will be echoed to the screen. (2) the config files are updated
in-place when the
-i option is used.
Manually managed conf files can be protected against changes by adding a comment containing the
KSCONF-NO-SORT to the top of any .conf file.
usage: ksconf sort [-h] [--target FILE | --inplace] [-F] [-q] [-n LINES] FILE [FILE ...]
|FILE||Input file to sort, or standard input.|
|--target, -t||File to write results to. Defaults to standard output.|
Replace the input file with a sorted version.
WARNING: This a potentially destructive operation that may move/remove comments.
|-n, --newlines||Number of lines between stanzas.|
In-place update arguments¶
|-F, --force||Force file sorting for all files, even for files containing the special ‘KSCONF-NO-SORT’ marker.|
|-q, --quiet||Reduce the output. Reports only updated or invalid files. This is useful for pre-commit hooks, for example.|
See Pre-commit hooks for more information about how the
sort command can be easily integrated in your git workflow.