#Update URLs in a multisite Wordpress installation after a domain change
You will need wp-cli for this.
wp search-replace --url=<original_domain> <original_domain> <new_domain> --recurse-objects --network --skip-columns=guid
wp search-replace --network <original_domain> <new_domain>
If you are also transforming a subdomain installation into a directory based one, read through this and this.