С инструментами GNU:
grep -rlZ --include='*.py' -e 'import project.path.util' \
-e 'from project.path.util import.*\bfoo\b' . |
xargs -r0 sed -i 's/\bfoo\b/bar/g'
Это работает, запрашивая с grep
до
-r
) -l
) -Z
) - include =' *. Py '
) и запрос sed
выполнить замену на месте ( -i
) во всех сопоставлениях файлы, если они есть ( xargs -r
).
Имя инструмента goss !
Из README:
What is Goss?
Goss is a YAML based serverspec alternative tool for validating a server’s configuration. It eases the process of writing tests by allowing the user to generate tests from the current system state. Once the test suite is written they can be executed, waited-on, or served as a health endpoint.