... | ... |
@@ -173,6 +173,12 @@ In a section |
173 | 173 |
sed -i '/^\[section\]/{$!{N;s/key=.*/key=NewMULTILINE/;ty;P;P;:y}}' infile |
174 | 174 |
``` |
175 | 175 |
|
176 |
+# Extract value from an ini file |
|
177 |
+Warning: iworks only for first key after [section] |
|
178 |
+``` |
|
179 |
+sed -nr '/\[section\]/ { :l /^[ |\t]*key[ |\t]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}' |
|
180 |
+``` |
|
181 |
+ |
|
176 | 182 |
# Match several times the same key=value |
177 | 183 |
```bash |
178 | 184 |
awk 'match($0, /ID>(TWA[^ ]+AS)<\/ID>/, asid){if(match($0, /Strategy="([^ ]+)">/, strategy)){print asid[1], strategy[1]}}' *.AS |