Questions tagged [yaml]

YAML is a data serialisation format designed for human readability, supporting data with self references. YAML 1.2 is a superset of JSON, so its tools can be used to process JSON. Use this tag for question that involve features specific to the YAML format.

YAML is a human readable data serialisation format. Its readability make it a popular choice for configuration files that have no special tools for editing.

YAML is currently at revision 1.2 (from 2009) although care must be taken that some parsers still only support version 1.1 or default to supporting its deprecated features ( octals not requiring Oo, sexagesimals, Yes/No/On/Off as booleans).

Commandline tools that can handle YAML:

  • yaml (installable by pip install ruamel.yaml.cmd
87 questions
6
votes
5 answers

How do I remove all specific sub-sections of a specific header in a YAML file?

I'm using bash shell. I have a YAML file from which I want to remove certain blocks of text. /image-content: post: operationId: createEventPublic summary: Process events description: Process events parameters: [] …
Dave
  • 2,548
3
votes
2 answers

How to extract a few IP addresses from a YAML file

I have this file, and I'd like to select all the IP addresses under the masters/hosts section if their line is not commented. I tried this sed 's/.*\ \([0-9\.]\+\).*/\1/g', but it did not work. metal: children: masters: hosts: …
Jackson
  • 215
  • 1
  • 2
  • 7
0
votes
1 answer

bash to get required lines from file using sed/awk

File content as below: Text1: text_1: Text1 text_1 text_2: - text - file1:\\ - file2:\\ Text2: text_1: Text2 text_1 text_2: - text - file3:\\ Text3: etc Output: print "file:\" entries for given Textn. Any…
Rang's
  • 11
0
votes
3 answers

Determine IP address and edit the config in single command

I'm trying to determine internal IP of a docker container and use that as an value in an yaml config file. The command for determining the IP is; docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}'…