There’s a directory full of .dat files that I needed to change a string in. But there were hundreds of files nested in different folders in a directory, let’s just call it /var/folders/apptemp. The following command would change hello to hi. It aint purdy and we’re piping to xargs ’cause stdin but it works.
This can be kinda’ dangerous so proceed with caution:
find /var/folders/apptemp -name "*.dat" -print0 | xargs -0 sed -i '' -e 's/hello/hi/g'