Questions tagged [yq]

yq is the name of two tools for interpreting and processing YAML (one Python based and one Go/CLI based).

yq is the name of two independent tools:

  • Python yq is a wrapper of that reads YAML in, transforms it into JSON and then executes the given commands via jq on it. It also supports processing XML via the executable xq. [GitHub, Documentation, Change log, Issues, PyPI]

  • Go yq implements actions similar to natively on YAML, which means that it can process YAML-specific entities like tags, which Python yq can't. [Github, Documentation]

The two tools do not share the same command line interface and are, in general, not interchangeable with each other. When asking questions about them, you should indicate which one you are using.

337 questions
-1
votes
1 answer

How to install `yq` with Mach-O 64-bit executable? I got error `bad CPU executable`

I'm not very familiar with Mac system, so I used brew install jq and brew install yq, then I got: $ file /usr/local/bin/xxx/lib/jq /usr/local/bin/xxx/lib/jq: Mach-O 64-bit executable x86_64 $ file…
wawawa
  • 2,835
  • 6
  • 44
  • 105
-1
votes
1 answer

YQ 4.7.0 - How to traverse each array elements and update value

I have a yaml: global: resolve_timeout: 5m receivers: - name: alerts-null - name: default local_configs: - api_url: https://abx.com channel: '#abx' send_resolved: true username: abc-123 - name: devops-alerts local_configs: …
Himanshu Singh
  • 199
  • 3
  • 15
-1
votes
1 answer

Is there a way to change to a ip addess in URL using yq command

I am looking how can i change from localhost to ip address using yq command. Below is the example from : api: in: http://localhost:1141/test-new-api/rest/apiIntegration out: http://localhost:1141/test-new-api/rest/outputIntegration TO: …
Kalyan
  • 11
  • 1
  • 5
-1
votes
1 answer

Parsing XML to CSV using xq and jq

There is some terminal command for parsing xml to csv in python xq syntax (also python-yq installed required): xq -r '[.yml_catalog.shop.offers.offer[] | [."@id", ."@available", .price, .name, .description]] | . |= [["id", "available", "price",…
Aleksey
  • 9
  • 1
  • 3
-1
votes
1 answer

Construct a command based upon a count variable in bash

I want to construct a command based upon the number of groups in the yaml file shown in the Example.. Example: I have groups command as below which extracts the groups from the iamIdentityMappings yaml file, groups=$(yq read -j…
Rad4
  • 1,936
  • 8
  • 30
  • 50
-2
votes
1 answer

count number of services form docker-compose.yaml file without applying docker-compose up

I need to count no of services in docker-compose.yaml file, i.e with out apply it, like filtering yaml file using yq or any other method in Linux. for example my file is services: service-1: image: image2 service-2: image: image …
-3
votes
3 answers

How to replace string after colon using sed, awk, regex, yq etc and can run using shell script

I have a yaml file and in that file I need to replace a specific string that comes after oauth2accesstoken: using a shell script my current shell script :- #!/bin/sh password=$(gcloud auth print-access-token) password="$password" yq -i…
gaurav agnihotri
  • 259
  • 1
  • 5
  • 14
1 2 3
22
23