I want to monitor/follow changes of a CSV file (some logging output of a robot). It is a huge file with <TAB>
as delimiter and the first row with header information.
So far, I am using the output of tail - f <file.csv>
, but it is not formatted per column, and looks like:
yAccelRaw zAccelRaw xGyroRaw ... ... ...
3 256 1 ... ... ...
4 255 3 ... ... ...
4 255 -6 ... ... ...
3 253 -1 ... ... ...
4 254 2 ... ... ...
5 255 0 ... ... ...
4 255 3 ... ... ...
5 254 3 ... ... ...
5 253 -1 ... ... ...
4 255 3 ... ... ...
With a CSV with 30 or more columns, understanding which value belongs to which column is not really easy. I was wandering if there is a general solution for printing the output formatted as table?
So far, I use tail -f <file.csv> | cut -f5,6
to cut out specific columns and observe their output, but I would prefer the full overview. Also, I tried piping the result to column
which doesn't get updated.
less -S -F
idea? I cannot scroll when piping the result to less. Also, the header gets eaten. – Marcus Jun 29 '17 at 22:00+F
not-F
. It makes less do atail -f
initially. You cannot scroll at this point. You have to interrupt with control-c to stop the tailing, but you stay inside less. you can then scroll: check your keybindings in less if you cannot. When you have the view of the columns you want you can type F again to continue tailing with these columns. – meuh Jun 30 '17 at 05:35less
, then scroll, and try to continue,less
is "Waiting for data... (interrupt to abort)" indefinetly. My work around is piping to less without+F
, scroll and then initiate following withshift+F
(that also is non-pausable of course in terms of "continue following after pausing"). I assume there is an issue with following a piped input. – Marcus Jul 04 '17 at 17:36less
because the control-c can also be delivered to the command as a signal which will probably stop it. The simplest answer is to put the result in a file and useless
on that file, so that a control-c will only be received byless
. Or you can pipe from a shell script if you get it to ignore signals withtrap '' int
. You will have difficulty stopping the script: a useful trick is to use control-z to put it in the background then use a kill command, or use the quit signal (control-\). – meuh Jul 04 '17 at 18:06