def sed ( match , replacement , path , modifiers = "" ) : cmd = "sed -r -i 's/%s/%s/%s' %s" % ( match , replacement , modifiers , path ) process = Subprocess ( cmd , shell = True ) ret , out , err = process . run ( timeout = 60 ) if ret : raise SubprocessError ( "Sed command failed!" )
python how to call sed
Perform sed text substitution .
def sed(match, replacement, path, modifiers=""):
    """
    Perform sed text substitution.
    """
    cmd = "sed -r -i 's/%s/%s/%s' %s" % (match, replacement, modifiers, path)

    process = Subprocess(cmd, shell=True)
    ret, out, err = process.run(timeout=60)
    if ret:
        raise SubprocessError("Sed command failed!")