wp cli search-replace scripting
-
I have a bash script that runs a search-replace on every table in my WordPress installation. It works fine, but I would like to get more specific information of the changes.
This is part of my bash script:
SITE_LIST=site_list.csv OLDIFS=$IFS IFS=, while read ID URL UPDATED CREATED do wp --allow-root --url=$URL search-replace $OLD $NEW done < $SITE_LIST IFS=$OLDIFS
I used the –log option and it worked as expected, but the log was 30MB, and not easy to parse the data of what changed.
Ideally, I would like to capture the following two bold lines from each wp search replace command as it’s run.
wp –allow-root –url=$URL search-replace $OLD $NEW wp_1_options
+--------------+--------------+--------------+------+ | Table | Column | Replacements | Type | +--------------+--------------+--------------+------+ | wp_1_options | option_name | 0 | SQL | <strong>| wp_1_options | option_value | 1 | PHP |</strong> | wp_1_options | autoload | 0 | SQL | +--------------+--------------+--------------+------+ <strong>Success: Made 1 replacement.</strong>
Is something like this possible?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘wp cli search-replace scripting’ is closed to new replies.