Execute isto:
cat a.json | awk -v file="data.txt" -f substitude.awk
Onde
substitude.awk
BEGIN{
while(getline < file) {
split($0, data, ":");
key = "%%" tolower(data[1]) "%%";
value = data[2];
gsub(/^\s*\"|\"\s*$/, "", value)
map[key] = value;
}
}{
s = $0;
for(key in map) {
gsub(key, map[key], s);
}
print s;
}END{
}
data.txt:
Id: "123"
Company: "Acme CO"
Address: "123 Main Street"
Zip: "12345"
a.json:
{ "identifier": "%%id%%", "name": "%%company%%" }
Resultado
{ "identifier": "123", "name": "Acme CO" }