Last active
August 6, 2020 18:47
-
-
Save jessuppi/53880a878b4615e4353a60adf7d58ca9 to your computer and use it in GitHub Desktop.
Complex Sed Replace Examples
This file contains hidden or 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
## fix hyperlinks (but not media src as they are shared with production uploads folder) ## | |
# sed 's#href="https://$SITE_DOMAIN#href="https://$SITE_DOMAIN/staging#g' /tmp/staging.sql | |
# sed 's#href="http://$SITE_DOMAIN#href="https://$SITE_DOMAIN/staging#g' /tmp/staging.sql | |
# sed 's#href="//$SITE_DOMAIN#href="https://$SITE_DOMAIN/staging#g' /tmp/staging.sql | |
# sed "s#href='https://$SITE_DOMAIN#href='https://$SITE_DOMAIN/staging#g" /tmp/staging.sql | |
# sed "s#href='http://$SITE_DOMAIN#href='https://$SITE_DOMAIN/staging#g" /tmp/staging.sql | |
# sed "s#href='//$SITE_DOMAIN#href='https://$SITE_DOMAIN/staging#g" /tmp/staging.sql | |
## fix sources (mirrors to production uploads folder using Nginx alias so this is just for cleaner source code) ## | |
# sed 's#src="https://$SITE_DOMAIN#src="https://$SITE_DOMAIN/staging#g' /tmp/staging.sql | |
# sed 's#src="http://$SITE_DOMAIN#src="https://$SITE_DOMAIN/staging#g' /tmp/staging.sql | |
# sed 's#src="//$SITE_DOMAIN#src="https://$SITE_DOMAIN/staging#g' /tmp/staging.sql | |
# sed "s#src='https://$SITE_DOMAIN#src='https://$SITE_DOMAIN/staging#g" /tmp/staging.sql | |
# sed "s#src='http://$SITE_DOMAIN#src='https://$SITE_DOMAIN/staging#g" /tmp/staging.sql | |
# sed "s#src='//$SITE_DOMAIN#src='https://$SITE_DOMAIN/staging#g" /tmp/staging.sql | |
## copy salt keys from production to staging (enables permanent login on both production/staging) ## | |
# sed "/'AUTH_KEY'/c\\$PROD_AUTH_KEY" /var/www/html/staging/wp-config.php | |
# sed "/'SECURE_AUTH_KEY'/c\\$PROD_SECURE_AUTH_KEY" /var/www/html/staging/wp-config.php | |
# sed "/'LOGGED_IN_KEY'/c\\$PROD_LOGGED_IN_KEY" /var/www/html/staging/wp-config.php | |
# sed "/'NONCE_KEY'/c\\$PROD_NONCE_KEY" /var/www/html/staging/wp-config.php | |
# sed "/'AUTH_SALT'/c\\$PROD_AUTH_SALT" /var/www/html/staging/wp-config.php | |
# sed "/'SECURE_AUTH_SALT'/c\\$PROD_SECURE_AUTH_SALT" /var/www/html/staging/wp-config.php | |
# sed "/'LOGGED_IN_SALT'/c\\$PROD_LOGGED_IN_SALT" /var/www/html/staging/wp-config.php | |
# sed "/'NONCE_SALT'/c\\$PROD_NONCE_SALT" /var/www/html/staging/wp-config.php | |
# sed -n "#NONCE_SALT#c $PROD_NONCE_SALT#p" /var/www/html/staging/wp-config.php |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reserving first comment