use sed to search replace
https://askubuntu.com/questions/816321/problem-using-sed-to-replace-urls-in-html-files-with-script
check if previous command executed successfully
https://askubuntu.com/questions/29370/how-to-check-if-a-command-succeeded
append date to string
https://stackoverflow.com/questions/1401482/yyyy-mm-dd-format-date-in-shell-script
appending current date to filename or string
https://unix.stackexchange.com/questions/57590/appending-a-current-date-from-a-variable-to-a-filename
# shell function
# search for nextdoor.test, replace with nextdoor.ciwork.co
# sql file is exported with date appended at the end
# thats why this script needs the date to match the exported sql file name
function updatedb() {
# first execute the command
sed -i -- "s#nextdoor.test#nextdoor.ciwork.co#g" "nextdoor_`(date +%F)`.sql"
# now check if it was sucessful
if [ $? -eq 0 ]; then
echo "replaced nextdoor.test with nextdoor.ciwork.co"
else
echo "Unable to search and replace"
fi
}