A quick overview: We're trying to convert some very long standing (7+ year old) WordPress Multisite installations from Subdomain to Subdirectory. Changing the wp-config.php and .htaccess is all well and good. But some of these installations have well over 1000 sites, and littered throughout the database can have an immense number of instances of abc.multisite.com.
I'm trying to find the best way to automate the conversion of abc.multisite.com to multisite.com/abc, of course without it affecting 123abc.multisite.com leading to 123multisite.com/abc.
All of the find/replace plugins I've seen that could do this only do a single search at a time, and I've got thousands of records to replace.
What would the best way to go about this? Is there an SQL command that I could loop through in PHP to dig through the hundreds of DB tables?
I can get a list of the sites using the get_sites() function and loop through that.
Or is there a better tool to export the database and find/replace there (the size of some of these DBs would crash atom/sublime/brackets.