'grep specific values from .yml file
I want to extract a specific value from value.yml file
- slug: 2352T
en:
term: "abc"
def: >
ASY
YFH
UUU
pt:
term: "cbb"
def: >
ATF
TTT
- slug: HSOD5
en:
term: "cbs"
def: >
AEG
WWW
af:
term: "xbb"
def: >
AUT
From this file, I want to use grep or anything else to extract only the following values:
- slug: 2352T
en:
term: "abc"
def: >
ASY
YFH
UUU
- slug: HSOD5
en:
term: "cbs"
def: >
AEG
WWW
Can you help me with that, please?
I tried this
grep "slug" value.yml | awk -F ": " '{print $2}'
and I tried
yq r --printMode pv "slug.en.*"
and tried
yq r value.yml slug.en
and
yq r value.yml --collect slug.en.def
but none of them worked
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
