I have been in DevOps related jobs for past 6 years dealing mainly with Kubernetes in AWS and on-premise as well. I spent quite a lot …
![post image](/images/blog/linux-1_hu928a111b75a731678aae189a5163bdac_17752_eedd5336be16616ed0b2dcda96bc315e.webp)
How to use regexp with jq
How to use regexp within jq
when selecting documents
PROJECT_NAMES="one|two|there"
REGEXP_SOL_PROJ="^prefix-${ENVIRONMENT}-(${PROJECT_NAMES}).*"
REGION="europe-west3"
HSM_PROJ=$(gcloud projects --format=json list | jq -r --arg RGEXP "^eaut-${ENVIRONMENT}-hsm-dap-kernel.*$" '.[] | select(.projectId|test($RGEXP)) | .projectId')
Links:
202406171306