shell script to recursively search and find/replace text in target files
Posted on 2011-02-16
This is probaably a 1 minute solution for many script maseters, but for me is quite muddy.
1. Recursively search all child directories for file WP-CONFIG.PHP
2. Find all "Lines" that begin with define('DB_PASSWORD', 'xxxxxx'); -- note 'xxxxxx' can be any length text.
3. Replace the 'xxxxxxx' text with new text that I would supply as paramter argument upon running the script.
4. Produce a count of the number of times the script found and editied a WP-CONFIG.PHP file.