Bootstrap FreeKB - yq - Parse YAML file using Mike Farah's yq CLI
yq - Parse YAML file using Mike Farah's yq CLI

Updated:   |  yq articles

Mike Farah's yq CLI and jq are similar, where Mike Farah's yq CLI is meant to parse YAML and jq is meant to parse JSON.

If you do not have Mike Farah's yq CLI installed on your Linux system, check out my article FreeKB - yq - Install Mike Farah's yq CLI.

Let's say my.yml contains the following.

foo: hello
bar: world

 

Here is how to parse the entire YAML file.

~]$ yq eval . my.yml
foo: hello
bar: world

 

Here is how to return the value of the "foo" key.

~]$ yq eval .foo my.yml
hello

 

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 5a9820 in the box below so that we can be sure you are a human.