Skip to content

Commit 33b7947

Browse files
committed
Add more -0 examples and change "between outputs" to "after each output"
1 parent 954fb19 commit 33b7947

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

NEWS.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,23 @@ Changes
6868
- Add `--binary`/`-b` on Windows for binary output. To get `\n` instead of `\r\n` line endings. 0dab2b1 @nicowilliams
6969
- Add `--nul-output`/`-0` for null (zero byte) separated output. #1990 @pabs3, #2235 @asottile
7070
```sh
71-
# will output a zero byte between outputs
71+
# will output a zero byte after each output
7272
$ jq -n0 '1,2,3' | xxd
7373
00000000: 3100 3200 3300 1.2.3.
74-
# can for example be used with xargs -0
75-
$ jq -n -0 1,2,3 | xargs -0 -n1
76-
1
77-
2
78-
3
74+
# can be used with xargs -0
75+
$ jq -n -0 '"a","b","c"' | xargs -0 -n1
76+
a
77+
b
78+
c
79+
$ jq -n -0 '"a b c", "d\ne\nf"' | xargs -0 printf '%q\n'
80+
'a b c'
81+
'd'$'\n''e'$'\n''f'
82+
# can be used with read -d ''
83+
$ while IFS= read -r -d '' json; do
84+
> jq '.name' <<< "$json"
85+
> done < <(jq -n -0 '{name:"a b c"},{name:"d\ne\nf"}')
86+
"a b c"
87+
"d\ne\nf"
7988
```
8089
- Fix issue converting string to number after previous convert error. #2400 @thalman
8190

0 commit comments

Comments
 (0)