I'm seeing my content truncated when using pipe in a sequence like:
jq ... |
jq ... |
tee tee_file |
jq ... |
# content gets truncated here
head ... | sed ... | awk ... | awk ... | sed
...but everything works fine if I redirect output to intermediary file, then immediately feed that file to the downstream processes:
jq ... |
jq ... |
tee some_file |
jq ... > intermediary_file
# content remains intact here
cat intermediary_file |
head ... | sed ... | awk ... | awk ... | sed
The tee_file
is not used as input in the downstream part of the above piping sequence, only in some later commands.
Using --unbuffered
in jq
doesn't help.
What are the reasons for such difference in behaviour, and how can I fix it?
MacOS High Sierra 10.13.6 (17G5019) GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin17)