This commit is contained in:
Hans Karlinius
2024-12-03 03:26:40 +01:00
parent 443a2366db
commit 33eeb23f68
2 changed files with 24 additions and 5 deletions

View File

@@ -9,15 +9,34 @@ $0 ~ "^\\[" section "\\]" {
found_section = 1;
}
$0 ~ "^\\[" key "\\]" {
if (found_section)
$0 ~ "^" key "=" {
if (found_section) {
found_key = 1;
if (value) {
print key "=" value;
}
}
}
$0 ~ "^\\[" {
if (found_section && !found_key) {
found_key = 1;
if (value) {
print key "=" value;
}
}
}
/.*/ {
print $0;
if(!found_key) {
print $0;
}
}
END {
print "Found section: " section " " found_section " and " key " " found_key;
#print "Found section: " section " " found_section " and " key " " found_key;
if (!found_section) {
print "[" section "]";
print key "=" value;
}
}