mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-07 02:48:27 +08:00
v4.32.1
This commit is contained in:
+1
-19
@@ -1,6 +1,6 @@
|
||||
# Subtract
|
||||
|
||||
You can use subtract to subtract numbers, as well as removing elements from an array.
|
||||
You can use subtract to subtract numbers as well as remove elements from an array.
|
||||
|
||||
## Array subtraction
|
||||
Running
|
||||
@@ -59,24 +59,6 @@ a: -1.5
|
||||
b: 4.5
|
||||
```
|
||||
|
||||
## Number subtraction - float
|
||||
If the lhs or rhs are floats then the expression will be calculated with floats.
|
||||
|
||||
Given a sample.yml file of:
|
||||
```yaml
|
||||
a: 3
|
||||
b: 4.5
|
||||
```
|
||||
then
|
||||
```bash
|
||||
yq '.a = .a - .b' sample.yml
|
||||
```
|
||||
will output
|
||||
```yaml
|
||||
a: -1.5
|
||||
b: 4.5
|
||||
```
|
||||
|
||||
## Number subtraction - int
|
||||
If both the lhs and rhs are ints then the expression will be calculated with ints.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user