Last active
November 5, 2019 18:31
-
-
Save jmstfv/2dbe896eb2554c59621832a4aa043f12 to your computer and use it in GitHub Desktop.
Replace all occurrences of a string in any file on MacOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Replace all occurrences of a string in any file on MacOS | |
# Substitute "html" with a target file extension | |
# using find (built-in) | |
find . -name '*.html' -print0 | xargs -0 sed -i "" "s/replaceme/withthis/g" | |
# using fd (https://github.com/sharkdp/fd) | |
fd -e html --print0 | xargs -0 sed -i "" "s/replaceme/withthis/g" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment