ksconf filter¶
Filter the contents of a conf file in various ways. Stanzas can be included or excluded based on provided filter, based on the presents or value of a key.
Where possible, this command supports GREP-like arguments to bring a familiar feel.
usage: ksconf filter [-h] [-o FILE] [--comments] [--verbose]
[--match {regex,wildcard,string}] [--ignore-case]
[--invert-match] [--files-with-matches]
[--count | --brief] [--stanza PATTERN]
[--attr-present ATTR] [--keep-attrs WC-ATTR]
[--reject-attrs WC-ATTR]
CONF [CONF ...]
Positional Arguments¶
CONF | Input conf file |
Named Arguments¶
-o, --output | File where the filtered results are written. Defaults to standard out. |
--comments, -C | Preserve comments. Comments are discarded by default. |
--verbose | Enable additional output. |
--match, -m | Possible choices: regex, wildcard, string Specify pattern matching mode.
Defaults to ‘wildcard’ allowing for |
--ignore-case, -i | |
Ignore case when comparing or matching strings. By default matches are case-sensitive. | |
--invert-match, -v | |
Invert match results. This can be used to show what content does NOT match, or make a backup copy of excluded content. |
Output mode¶
Select an alternate output mode. If any of the following options are used, the stanza output is not shown.
--files-with-matches, -l | |
List files that match the given search criteria | |
--count, -c | Count matching stanzas |
--brief, -b | List name of matching stanzas |
Stanza selection¶
Include or exclude entire stanzas using these filter options.
All filter options can be provided multiple times.
If you have a long list of filters, they can be saved in a file and referenced using
the special file://
prefix.
--stanza | Match any stanza who’s name matches the given pattern.
PATTERN supports bulk patterns via the file:// prefix. |
--attr-present | Match any stanza that includes the ATTR attribute.
ATTR supports bulk attribute patterns via the file:// prefix. |
Attribute selection¶
Include or exclude attributes passed through. By default all attributes are preserved. Whitelist (keep) operations are preformed before blacklist (reject) operations.
--keep-attrs | Select which attribute(s) will be preserved. This space separated list of attributes indicates what to preserve. Supports wildcards. |
--reject-attrs | Select which attribute(s) will be discarded. This space separated list of attributes indicates what to discard. Supports wildcards. |