I'm supposed to follow a logfile, I want to initiate a sed command to edit conffile upon appearance of certain line in the log. I did little research and found out that it can be done with awk.
and the syntax is like:
tail -f /path/to/serverLog | awk '
/Printer is on fire!/ { system("shutdown -h now") }
/new USB high speed/ { system("echo \"New USB\" | mail admin") }'
as proposed in this answer
so I wrote my own like with a sed variant:
tail -f logfile | awk '/^Jit ended**/ { system("sed -E '/^Jit/{s/enabled=false/enabled=true/; s/From=[0-9]+-[0-9]+-[0-9]+/From=2021-02-01/}' conffile") }'
but it doesn't work, and throws errors like
(^ syntax error|^ unterminated string)
I guess this is to do something with {} in the sed command not getting compatible with awk syntax, but no idea where exactly, and how to get it work.