Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Bash script to export a database from a WordPress container and perform a search/replace using the UNIX command "sed". Script is based on
#! /bin/bash
# Dump the file
DUMP=$(docker exec $CONTAINER wp db export --add-drop-table --porcelain)
echo "Dump completed. Filename: $DUMP"
# Replace in file
sed -i -e "s/$SEARCH/$REPLACE/g" $DUMP
echo "Search and replace completed"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.