6816 shaares
Sometimes you only want to modify files containing specific content. Combine find, grep, and sed:
# Only replace in files that contain the old text
find . -name "*.yaml" -type f -exec grep -l "oldValue" {} \; | xargs sed -i 's/oldValue/newValue/g'