Skip to content

Instantly share code, notes, and snippets.

@dmgig
Created June 3, 2016 15:56
Show Gist options
  • Save dmgig/4b79fd2d29f7e52e5b5764b5475d6002 to your computer and use it in GitHub Desktop.
Save dmgig/4b79fd2d29f7e52e5b5764b5475d6002 to your computer and use it in GitHub Desktop.
Find/Replace Inside Files and In Filenames (Mac 10.11)
#!/bin/bash
find /path/to/files -type f -exec sed -i "" 's/oldtext/newtext/g' {} \; # find/repalce inside files
find /path/to/files -type f -name "*" -exec sh -c 'mv "$0" "${0/oldfilenametext/newfilenametext}"' '{}' \; # find and replace in filenames
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment