I have this file:
[default]
region = us-east-1
output = json
[profile automation]
region = us-east-1
output = json
[profile qa]
region = us-east-1
output = json
I need to extract only the profile names like so:
default
automation
qa
My sed so far:
gsed 's?\[[^\ ]*\ \([^\]]*\)?\1?' ~/.aws/config
As I'm testing, I can see that \([^\]]*\)
matches only the first character after the space for example: the a
in automation
, the q
in qa etc..
Why it only matches once?
Do you have a better way of stripping the []
?
Thanks.