Skip to content

Instantly share code, notes, and snippets.

@pagebrooks
Last active December 23, 2015 03:59
Show Gist options
  • Save pagebrooks/6576824 to your computer and use it in GitHub Desktop.
Save pagebrooks/6576824 to your computer and use it in GitHub Desktop.
sed one-liner that will inject value into configuration file.
# Find a string that starts with bind-address= and replace anything after the = with 0.0.0.0
# For example, in the my.cnf file, this would replace:
# bind-address = 127.0.0.1
# with
# bind-address = 0.0.0.0
sed -i 's/^\(bind\-address\s*=\s*\).*$/\10\.0\.0\.0/' /etc/mysql/my.cnf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment