yaml-searcher
A command line utility to search through yaml for a specific value.
It reads yaml from stdin and outputs the value you are searching for.
Examples
Search in yaml for result of field hello.world
yaml-file.yaml
hello:
world: "output"
redirect yaml file
./yaml-searcher hello.world < yaml-file.yaml
pipe in yaml file
cat yaml-file.yaml | ./yaml-searcher hello.world
Both will return output
Installation
-
Download yaml-searcher
curl -L https://github.com/mgla96/yaml-searcher/releases/download/v0.1.5/yaml-searcher > yaml-searcher
-
Add execution permissions
chmod +x yaml-searcher
-
Place in executable PATH or call directly
Notes / Gotchas
-
zsh uses square brackets for globbing/pattern matching
when passing square brackets in search argument for yaml-searcher, you must either escape them or quote argument
yaml-file.yaml
hello: - world: "output" - world: "output2"
command
./yaml-searcher 'hello[0]' < yaml-file.yaml
./yaml-searcher hello\[0\] < yaml-file.yaml
returns
world: output