Last active
July 25, 2022 16:51
-
-
Save canonex/0fff3cf2de03d789df7a3faa5ab2c0bf to your computer and use it in GitHub Desktop.
Wordpress dump siteurl extractor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#If working from a dump | |
DB=mydb.sql | |
grep -F "'siteurl'," "$DB" | head -c 200 | sed 's/, /,/g' | sed 's/^.*\(siteurl.*\)/\1/g' | sed "s/'/ /g" | egrep -o 'https?://[^ ]+' | head -1 | |
#If working in a wordpress env with wp-cli | |
#wp db query "SELECT option_value FROM $(wp config get table_prefix)options WHERE option_name='siteurl'" --skip-column-names | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment