Removed dud instructions

This commit is contained in:
Mike Farah 2018-05-07 16:26:02 +10:00
parent 56a0771cd1
commit c5a45ba7d5
3 changed files with 1 additions and 43 deletions

View File

@ -256,13 +256,6 @@
Splat
</a>
</li>
<li class="md-nav__item">
<a href="#handling-in-the-yaml-key" title="Handling '.' in the yaml key" class="md-nav__link">
Handling '.' in the yaml key
</a>
</li>
<li class="md-nav__item">
@ -380,13 +373,6 @@
Splat
</a>
</li>
<li class="md-nav__item">
<a href="#handling-in-the-yaml-key" title="Handling '.' in the yaml key" class="md-nav__link">
Handling '.' in the yaml key
</a>
</li>
<li class="md-nav__item">
@ -469,17 +455,6 @@ bob:
- apples
</code></pre>
<h3 id="handling-in-the-yaml-key">Handling '.' in the yaml key<a class="headerlink" href="#handling-in-the-yaml-key" title="Permanent link">&para;</a></h3>
<p>Given a sample.yaml file of:</p>
<pre><code class="yaml">b.x:
c: 2
</code></pre>
<p>then</p>
<pre><code class="bash">yq r sample.yaml \&quot;b.x\&quot;.c
</code></pre>
<p>will output the value of '2'.</p>
<h3 id="arrays">Arrays<a class="headerlink" href="#arrays" title="Permanent link">&para;</a></h3>
<p>You can give an index to access a specific element:
e.g.: given a sample file of</p>

View File

@ -17,7 +17,7 @@
},
{
"location": "/read/",
"text": "yq r <yaml_file|json_file> <path>\n\n\n\n\nThis command can take a json file as input too, and will output yaml unless specified to export as json (-j)\n\n\nBasic\n\u00b6\n\n\nGiven a sample.yaml file of:\n\n\nb:\n c: 2\n\n\n\n\nthen\n\n\nyq r sample.yaml b.c\n\n\n\n\nwill output the value of '2'.\n\n\nFrom Stdin\n\u00b6\n\n\nGiven a sample.yaml file of:\n\n\ncat sample.yaml | yq r - b.c\n\n\n\n\nwill output the value of '2'.\n\n\nSplat\n\u00b6\n\n\nGiven a sample.yaml file of:\n\n\n---\nbob:\n item1:\n cats: bananas\n item2:\n cats: apples\n\n\n\n\nthen\n\n\nyq r sample.yaml bob.*.cats\n\n\n\n\nwill output\n\n\n- bananas\n- apples\n\n\n\n\nHandling '.' in the yaml key\n\u00b6\n\n\nGiven a sample.yaml file of:\n\n\nb.x:\n c: 2\n\n\n\n\nthen\n\n\nyq r sample.yaml \\\"b.x\\\".c\n\n\n\n\nwill output the value of '2'.\n\n\nArrays\n\u00b6\n\n\nYou can give an index to access a specific element:\ne.g.: given a sample file of\n\n\nb:\n e:\n - name: fred\n value: 3\n - name: sam\n value: 4\n\n\n\n\nthen\n\n\nyq r sample.yaml 'b.e[1].name'\n\n\n\n\nwill output 'sam'\n\n\nNote that the path is in quotes to avoid the square brackets being interpreted by your shell.\n\n\nArray Splat\n\u00b6\n\n\ne.g.: given a sample file of\n\n\nb:\n e:\n - name: fred\n value: 3\n - name: sam\n value: 4\n\n\n\n\nthen\n\n\nyq r sample.yaml 'b.e[*].name'\n\n\n\n\nwill output:\n\n\n- fred\n- sam\n\n\n\n\nNote that the path is in quotes to avoid the square brackets being interpreted by your shell.\n\n\nKeys with dots\n\u00b6\n\n\nWhen specifying a key that has a dot use key lookup indicator.\n\n\nb:\n foo.bar: 7\n\n\n\n\nyaml r sample.yaml 'b[foo.bar]'\n\n\n\n\nyaml w sample.yaml 'b[foo.bar]' 9\n\n\n\n\nAny valid yaml key can be specified as part of a key lookup.\n\n\nNote that the path is in quotes to avoid the square brackets being interpreted by your shell.",
"text": "yq r <yaml_file|json_file> <path>\n\n\n\n\nThis command can take a json file as input too, and will output yaml unless specified to export as json (-j)\n\n\nBasic\n\u00b6\n\n\nGiven a sample.yaml file of:\n\n\nb:\n c: 2\n\n\n\n\nthen\n\n\nyq r sample.yaml b.c\n\n\n\n\nwill output the value of '2'.\n\n\nFrom Stdin\n\u00b6\n\n\nGiven a sample.yaml file of:\n\n\ncat sample.yaml | yq r - b.c\n\n\n\n\nwill output the value of '2'.\n\n\nSplat\n\u00b6\n\n\nGiven a sample.yaml file of:\n\n\n---\nbob:\n item1:\n cats: bananas\n item2:\n cats: apples\n\n\n\n\nthen\n\n\nyq r sample.yaml bob.*.cats\n\n\n\n\nwill output\n\n\n- bananas\n- apples\n\n\n\n\nArrays\n\u00b6\n\n\nYou can give an index to access a specific element:\ne.g.: given a sample file of\n\n\nb:\n e:\n - name: fred\n value: 3\n - name: sam\n value: 4\n\n\n\n\nthen\n\n\nyq r sample.yaml 'b.e[1].name'\n\n\n\n\nwill output 'sam'\n\n\nNote that the path is in quotes to avoid the square brackets being interpreted by your shell.\n\n\nArray Splat\n\u00b6\n\n\ne.g.: given a sample file of\n\n\nb:\n e:\n - name: fred\n value: 3\n - name: sam\n value: 4\n\n\n\n\nthen\n\n\nyq r sample.yaml 'b.e[*].name'\n\n\n\n\nwill output:\n\n\n- fred\n- sam\n\n\n\n\nNote that the path is in quotes to avoid the square brackets being interpreted by your shell.\n\n\nKeys with dots\n\u00b6\n\n\nWhen specifying a key that has a dot use key lookup indicator.\n\n\nb:\n foo.bar: 7\n\n\n\n\nyaml r sample.yaml 'b[foo.bar]'\n\n\n\n\nyaml w sample.yaml 'b[foo.bar]' 9\n\n\n\n\nAny valid yaml key can be specified as part of a key lookup.\n\n\nNote that the path is in quotes to avoid the square brackets being interpreted by your shell.",
"title": "Read"
},
{
@ -35,11 +35,6 @@
"text": "Given a sample.yaml file of: ---\nbob:\n item1:\n cats: bananas\n item2:\n cats: apples then yq r sample.yaml bob.*.cats will output - bananas\n- apples",
"title": "Splat"
},
{
"location": "/read/#handling-in-the-yaml-key",
"text": "Given a sample.yaml file of: b.x:\n c: 2 then yq r sample.yaml \\\"b.x\\\".c will output the value of '2'.",
"title": "Handling '.' in the yaml key"
},
{
"location": "/read/#arrays",
"text": "You can give an index to access a specific element:\ne.g.: given a sample file of b:\n e:\n - name: fred\n value: 3\n - name: sam\n value: 4 then yq r sample.yaml 'b.e[1].name' will output 'sam' Note that the path is in quotes to avoid the square brackets being interpreted by your shell.",

View File

@ -43,18 +43,6 @@ will output
- apples
```
### Handling '.' in the yaml key
Given a sample.yaml file of:
```yaml
b.x:
c: 2
```
then
```bash
yq r sample.yaml \"b.x\".c
```
will output the value of '2'.
### Arrays
You can give an index to access a specific element:
e.g.: given a sample file of