I am using the following code to download streaming financial data
curl -s -H "Content-Type: application/json" -H "Authorization: Bearer XXX..." "https://...=EUR_USD" | jq --raw-output '[.time, .bids[0].price, .asks[0].price] | @csv'
which is successfully streaming in the terminal thus
"2020-05-05T10:02:37.060299264Z","1.08472","1.08481"
However, what I would really like is to further process this, using sed, to get
2020,05,05,10,02,37.060299264,1.08472,1.08481
and then append this to a file, let's call it "output," but when I try piping to sed I no longer see the streaming data although I'm sure my sed syntax is correct as I've checked it against a static test file.
So my question is: how do I further pipe to sed and then append to the file "output?"
stdbuf
,unbuffer
or similar (https://unix.stackexchange.com/a/25378/70524) and see if you get output – muru May 05 '20 at 11:27jq
itself has an option to unbuffer with--unbuffered
flag – Inian May 05 '20 at 11:35