linux - bash loop with GNU less that refreshes every 2 minutes -
i have linux machine data folder , script produces report xlsx spreadsheet file on ever changing content of folder being run. use xlsx2tsv script convert tsv text takes less 1 second. script takes 1 minute produce spreadsheet file , want have terminal screen showing results of table in gnu less buffer, can move around cursors, , search content /search
, etc. of up-to-date version of content.
at moment have bash while true; do
loop first calculates content of script, transforms tsv , pipes gnu less
. in terminal screen have while true; do
loop kills less
command every 2 minutes. leaves me 1 minute of inactivity, waiting spreadsheet updated before being able navigate content less
.
i optimise setup new spreadsheet produced in background not when kill less command, starting 1 minute before, updated less
command gives me working copy can navigate. ideally without having create third terminal window it.
any ideas? maybe gnu parallel?
current setup:
# screen in data folder less command while true; $home/script -dir $pwd && xlsx2tsv $(ls $pwd/*.xlsx) 1 | column -t | less -s -n; sleep 0.5; done # screen 2 less killing while true; pkill less; sleep 120; done
my less man page says "r" command
r repaint screen, discarding buffered input. useful if file changing while being viewed.
so, hit r refresh.
Comments
Post a Comment