PythonSed
PythonSed copied to clipboard
Applying in place changes file's permissions
Create somefile and get permissions (644)
$ echo "x" > somefile
$ stat -c "%a %n" somefile
644 somefile
run PythonSed in place and get permissions:
$ python3 -c "from PythonSed import Sed; sed = Sed(in_place=''); sed.load_string('s/x/y/'); sed.apply('somefile')"
$ stat -c "%a %n" somefile
600 somefile
Permissions are changed to 600