This commit is contained in:
Hans Karlinius
2024-12-03 03:35:37 +01:00
parent 33eeb23f68
commit 80968c383e
2 changed files with 5 additions and 2 deletions

View File

@@ -3,6 +3,7 @@
BEGIN {
found_section = 0;
found_key = 0;
edited_row = 0;
}
$0 ~ "^\\[" section "\\]" {
@@ -12,6 +13,7 @@ $0 ~ "^\\[" section "\\]" {
$0 ~ "^" key "=" {
if (found_section) {
found_key = 1;
edited_row = 1;
if (value) {
print key "=" value;
}
@@ -21,6 +23,7 @@ $0 ~ "^" key "=" {
$0 ~ "^\\[" {
if (found_section && !found_key) {
found_key = 1;
edited_row = 1;
if (value) {
print key "=" value;
}
@@ -28,7 +31,7 @@ $0 ~ "^\\[" {
}
/.*/ {
if(!found_key) {
if(!edited_row) {
print $0;
}
}