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
# Put the thing you need to find here, like this gnarly SQL. | |
# It has a bunch of annoying characters that sed doesn't like, | |
# so we have to escape them. | |
KEYWORD="SET @@GLOBAL.GTID_PURGED=/*!80000 '+'*/ '';"; | |
# Escape the gnarly stuff | |
ESCAPED_KEYWORD=$(printf '%s\n' "$KEYWORD" | sed -e 's/[]\/$*.^[]/\\&/g'); | |
# Now we can find and replace the now-escaped text | |
sed "s/$ESCAPED_KEYWORD/$ESCAPED_REPLACE/g" |
NewerOlder