xsv icon indicating copy to clipboard operation
xsv copied to clipboard

`tail -f`?

Open cajund opened this issue 6 years ago • 3 comments

Why doesn't this work?

tail -f file.csv | xsv table

This works:

tail file.csv | xsv table

Thanks.

cajund avatar Oct 13 '19 23:10 cajund

I think it's because tail -f is non-ending, the output stream is never closed, so xsv table is waiting for the end of the stream before it can output the table.

From the xsv table --help:

Note that formatting a table requires buffering all CSV data into memory.

borice avatar Oct 17 '19 13:10 borice

This answer is spot on, same as the sort command. @cajund anything else to address before this issue can be closed?

bronson avatar Dec 10 '19 18:12 bronson

You can do this:

tail -f file.csv  | (while read line; do echo "$line" | xsv table; done )

But the resulting cells will not be correctly aligned if their length are different.

Anyway, this method can be more useful with select

tail -f file.csv  | (while read line; do echo "$line" | xsv select 1; done )

alepez avatar Feb 13 '21 08:02 alepez