def sed(app: str, pattern: str, repl: str):
    """sed with extended regex and edit file in-place"""
    repl = repl.replace('$', '\$').replace('&', '\&').replace('=', '\='). \
        replace('`', '\`').replace('"', '\\"').replace('\n', '\\n')
    return f'sed -r "s={pattern}={repl}=" -i /tmp/daemon_{app}.sh'