0

My output.yml returned by aws cli looks like this:

ARN: random-arn
CreatedDate: 'some-random-date`
Name: random-name
SecretString: '{"Password":"fake-password","Hostname":"fake-host","Username":"fake-username"}'
VersionId: random-version
VersionStages:
- AWSCURRENT

I want to parse and fetch the Password and Username from the above file in bash to create another yaml file with below data:

Instance:
  Password: fake-password
  Username: fake-username

How can I do this in shell script?

jbot
  • 133
  • 1
  • 2
  • 8
  • Welcome to SO. Please read [ask] and provide a [mcve]. You can use `grep` to isolate the line you want (SecretString), and `cut`, `awk`, `sed` to extract the parts you want out of the line. Get started, do some research, ask again with a specific question. – Nic3500 Sep 10 '20 at 01:49
  • 1
    You can parse it yourself, or use a tool like [yq](https://kislyuk.github.io/yq/). – Todd A. Jacobs Sep 10 '20 at 02:47

0 Answers0