Identify old urls across multiple websites

I had a request from Jason Redcay to find any old references to redx.host, an old domain which is not longer active, and fix. This was on many various websites. I used the following commands on my backup server to identify the files/databases which contained “redx.host”. These can be adapted to other similar searches.

# Search all PHP files for reference
find . -iname "*.php" -type f -print0  | xargs -0 grep -H "redx.host" > ~/Tmp/redxhost-php.txt

# Search all CSS files for reference
find . -iname "*.css" -type f -print0  | xargs -0 grep -H "redx.host" > ~/Tmp/redxhost-css.txt

# Search all database files for reference
find . -iname "mysql.sql" -type f -print0  | xargs -0 grep -l "redx.host" > ~/Tmp/redxhost-sql.txt


Count entries
wc -l ~/Tmp/redxhost-php.txt
wc -l ~/Tmp/redxhost-css.txt
wc -l ~/Tmp/redxhost-sql.txt