79566635

Date: 2025-04-10 12:28:44
Score: 1.5
Natty:
Report link

Now you can also use variants of pick (or omit) given a sample.yml file of:

myMap:
  cat: meow
  dog: bark
  thing: hamster
  hamster: squeak

then

yq '.myMap |= pick(["hamster", "cat", "goat"])' sample.yml

will output

myMap:
  hamster: squeak
  cat: meow

See https://mikefarah.gitbook.io/yq/operators/pick#pick-keys-from-map

Reasons:
  • Probably link only (1):
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: jubr