Last active
August 31, 2023 01:26
-
-
Save rpherrera/d7a4d905775653b88e5f to your computer and use it in GitHub Desktop.
get aws ecr repositories names with aws cli, parsing results with jq and stripping double quotes with sed or tr
This file contains 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
#!/bin/bash | |
# stripping double quotes with sed | |
aws ecr describe-repositories | jq '.repositories[].repositoryName' | sed s/\"//g | |
# stripping double quotes with tr | |
aws ecr describe-repositories | jq '.repositories[].repositoryName' | tr -d '"' |
After some geeking around, turns out you can use --query
to get this exact output as well:
aws ecr describe-repositories --query "repositories[].[repositoryName]" --output text --no-cli-pager
Using aws-cli/2.2.38 Python/3.8.8
Awesome @DanielCalvo. Thank you very much.
and sorry if you want to filter even more, let's say specific image_tag on that repo, you'll add another jq paramenter?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can also use the jq "-r" to strip out the quotes.
aws ecr describe-repositories | jq -r '.repositories[].repositoryName'