Added string trim operator

This commit is contained in:
Mike Farah
2022-08-08 13:35:57 +10:00
parent 989dabac5a
commit a696dceea4
5 changed files with 53 additions and 0 deletions
@@ -112,6 +112,26 @@ will output
cat; meow; 1; ; true
```
## Trim strings
Given a sample.yml file of:
```yaml
- ' cat'
- 'dog '
- ' cow cow '
- horse
```
then
```bash
yq '.[] | trim' sample.yml
```
will output
```yaml
cat
dog
cow cow
horse
```
## Match string
Given a sample.yml file of:
```yaml