我有一個包含以下內容的測試文件。bash腳本在逗號後附加數據
[groups]
test_read = apple,orange
write = grapes,mango
[TEST:/]
@test_read= apple,orange
@write= grapes,mango
我需要添加對所有下組部分中的字段的字覆盆子其是上述[TEST:/]
預期輸出
[groups]
test_read = apple,orange,raspberry
write = grapes,mango,raspberry
[TEST:/]
@test_read= apple,orange
@write= grapes,mango
我與這一個襯墊試圖
awk 'NF > 1 {$NF = $NF ",raspberry"} 1' test
但它是在所有的領域添加覆盆子。
爲什麼是預期的輸出? 'tabbed'? – Inian