Skip to content

Instantly share code, notes, and snippets.

@jmstfv
Last active Nov 5, 2019
Embed
What would you like to do?
Replace all occurrences of a string in any file on MacOS
# 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