I am trying to extract word between "profile " and "]".
my contents
[profile gateway]
[profile personal]
[profile DA]
[profile CX]
for this i have tried
less ~/.aws/config |grep "\[profile"|sed -E 's/\[profile(.)//'
which gives
gateway]
personal]
DA]
CX]
I know can add a pipe and us tr to delete last "]" or even cut would do but can someone help me with above sed command with regex to remove last "]"