Screen big data without interrupting data conversion

不羁的心 提交于 2019-12-08 11:37:45

问题


This thread is an extension of this thread where the interruption (CTRL-c) stop the data transfer into less. I would like to create a similar system monitoring data conversion as is found in fdupes. I think this can be reached with GNU screen. The tools tee and buffers may not be needed for this so skip the two sections if you want.

Hex conversion and tee [skip if you know]

You can use whatever hex dumper you want for the task, for instance hexdump -v, od -v -t x1 and xxd -ps for the generation of the example data. You can create binary test data 1GB by the following command, discussed here

dd if=/dev/urandom of=sample.bin bs=64M count=16

Let's simplify the old situation without the while loop. Assume you have a very big file. You put it as STIN into less by

hexdump -v sample.bin | less -s -M +Gg

I am discussing here how to generate you big test files. With a big file, you get an empty screen when you do not press anything, since conversion under way. When you press CTRL-c, you get the data that has been already converted to the less at the bottom of the screen. This is not all data. Does the interruption by CTRL-c end the transfer of data from file into less?

Possibilities to fix this

  • refresh the less somehow if the conversion is still underway
  • bind tee command here somehow

Is there any way to avoid the interruption of the data conversion but be able to look the stream. I think tee command could be one possibility.

Buffers [I think not needed]

stdbuf -i0 -o0 -e0 xxd -ps sample.bin | stdbuf -i0 -o0 -e0 less -s -M +G

which does not resolve the problem. I should be able refresh the output in less, where I am using the flag R. Only interruption will show something in less.

I did not manage to get unbuffer command work similarly as stdbuf, discussing it here.

Screen

I think the best way to have a glimpse of the data conversion is to run everything inside screen. Logic: give stdout into less inside screen. Scroll the output in screen. I have completed such a task before which may be found in my thread about screen. I have to think this once more again. I would like to create a similar usability as in the command fdupes. I think tee and buffer may not even be needed.

How can you create screen about monitoring window when less is viewing parallerly data conversion?

来源:https://stackoverflow.com/questions/31048739/screen-big-data-without-interrupting-data-conversion

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!