Last active
August 29, 2015 14:07
-
-
Save larryv/daa6fffd5296b3ff2b94 to your computer and use it in GitHub Desktop.
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
# Save port to hold space. | |
/ has the variants/ { | |
s/ has .*$// | |
h | |
d | |
} | |
# Remove noise. | |
/conflicts with/d | |
/^[^:]*mariadb[^:]*:/b db_variant | |
/^[^:]*mysql[^:]*:/b db_variant | |
/^[^:]*percona[^:]*:/b db_variant | |
d | |
:db_variant | |
# Append desired suffix to variant name. | |
/^\[+\]/s/.*]\(.*\):.*$/\1 Default/ | |
/^[[:blank:]]*+/s/[[:blank:]]*+\(.*\):.*$/\1 Y/ | |
/^[[:blank:]]*[^+]/s/[[:blank:]]*\(.*\):.*$/\1 N/ | |
# Extract port name from hold space and append variant name and suffix. | |
x | |
s/[[:blank:]].*$// | |
G | |
s/\n/ / | |
# Print pattern space and save to hold space for subsequent lines. | |
p | |
h |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment