Fixed remove comments example

This commit is contained in:
Mike Farah
2021-01-14 09:12:14 +11:00
parent 54723c1a36
commit d3b2e37b66
2 changed files with 11 additions and 5 deletions
+6 -1
View File
@@ -78,17 +78,22 @@ b: dog # leave this
```
## Remove all comments
Note the use of `...` to ensure key nodes are included.
Given a sample.yml file of:
```yaml
a: cat # comment
# great
b: # key comment
```
then
```bash
yq eval '.. comments=""' sample.yml
yq eval '... comments=""' sample.yml
```
will output
```yaml
a: cat
b:
```
## Get line comment