1CRUDINI(1) User Commands CRUDINI(1)
2
3
4
6 crudini - manipulate ini files
7
9 crudini --set [OPTION]... config_file section [param] [value]
10 crudini --get [OPTION]... config_file [section] [param]
11 crudini --del [OPTION]... config_file section [param] [list value]
12 crudini --merge [OPTION]... config_file [section]
13
15 crudini - A utility for manipulating ini files
16
17 SECTION can be empty ("") or "DEFAULT" in which case, params not in a
18 section, i.e. global parameters are operated on. If 'DEFAULT' is used
19 with --set, an explicit [DEFAULT] section is added.
20
22 --existing[=WHAT]
23 For --set, --del and --merge, fail if item is missing, where
24 WHAT is 'file', 'section', or 'param', or if WHAT not specified;
25 all specified items.
26
27 --format=FMT
28 For --get, select the output FMT. Formats are
29 'sh','ini','lines'
30
31 --ini-options=OPT
32 Set options for handling ini files. Options are: 'nospace': use
33 format name=value not name = value
34
35 --inplace
36 Lock and write files in place. This is not atomic but has less
37 restrictions than the default replacement method.
38
39 --list For --set and --del, update a list (set) of values
40
41 --list-sep=STR
42 Delimit list values with "STR" instead of " ,". An empty STR
43 means any whitespace is a delimiter.
44
45 --output=FILE
46 Write output to FILE instead. '-' means stdout
47
48 --verbose
49 Indicate on stderr if changes were made
50
51 --help Write this help to stdout
52
53 --version
54 Write version to stdout
55
57 # Add/Update a var
58
59 crudini --set config_file section parameter value
60
61 # Add/Update a var in the root or global area. # I.e. that's not under
62 a [section].
63
64 crudini --set config_file "" parameter value
65
66 # Update an existing var
67
68 crudini --set --existing config_file section parameter value
69
70 # Add/Append a value to a comma separated list # Note any whitespace
71 around commas is ignored
72
73 crudini --set --list config_file section parameter a_value
74
75 # Add/Append a value to a whitespace separated list # Note multiline
76 lists are supported (as newline is whitespace)
77
78 crudini --set --list --list-sep= config_file section parameter
79 a_value
80
81 # Delete a var
82
83 crudini --del config_file section parameter
84
85 # Delete a section
86
87 crudini --del config_file section
88
89 # output a value
90
91 crudini --get config_file section parameter
92
93 # output a global value not in a section
94
95 crudini --get config_file "" parameter
96
97 # output a section
98
99 crudini --get config_file section
100
101 # output a section, parseable by shell
102
103 eval "$(crudini --get --format=sh config_file section)"
104
105 # update an ini file from shell variable(s)
106
107 echo name="$name" | crudini --merge config_file section
108
109 # merge an ini file from another ini
110
111 crudini --merge config_file < another.ini
112
113 # compare two ini files using standard UNIX text processing
114
115 diff <(crudini --get --format=lines file1.ini|sort) \
116
117 <(crudini --get --format=lines file2.ini|sort)
118
119 # Rewrite ini file to use name=value format rather than name = value
120
121 crudini --ini-options=nospace --set config_file ""
122
123 # Add/Update a var, ensuring complete file in name=value format
124
125 crudini --ini-options=nospace --set config_file section parameā
126 ter value
127
128
129
130crudini 0.9.4 December 2022 CRUDINI(1)