I'm trying to parse the lines of an .aws/config or .aws/credentials file of a specific profile such as [default] or [prod].
File example
[default]
region = us-east-1
output = json
[nonprod]
region = us-east-1
output = json
[uat]
region = us-east-2
output = json
[prod]
region = us-east-1
output = json
Does anybody have a (aws, sed, grep, etc) script that searches for (and displays) the lines after e.g. [default] until the start of the next profile, or if searching for prod starting with [prod] until the end of the file?
Examples
searchawsconfig default
searchawsconfig prod