Skip to content

Instantly share code, notes, and snippets.

@santisbon
Last active August 4, 2024 06:45
Show Gist options
  • Save santisbon/5283059 to your computer and use it in GitHub Desktop.
Save santisbon/5283059 to your computer and use it in GitHub Desktop.
How to find files and text in the shell and work with them. #linux #search
# Linux and Cygwin
find /test -name \*.txt -exec sed -i 's/oldValue/newValue/g' {} \;
# OS X.
# The -i option requires a file extension. Use "" to overwrite the file in place.
find /test -name \*.txt -exec sed -i "" 's/oldValue/newValue/g' {} \;
# Find a string in current directory and subdirectories, excluding some directories.
grep -r --exclude-dir={node_modules,amplify} mystring .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment