I have a program that has the following outputs:
Pack 1:
TimeStamp : 1001302
Data : [1 21 343 2 34 ]
Found : Yes
Pack 2:
TimeStamp : 1001303
Data : [1 21 344 2 35 ]
Found : Yes
Pack 3:
TimeStamp : 1001304
Data : [1 21 346 2 36 ]
Found : Yes
and so on ... repeating
The outputs to the terminal are created using c++ fprintf
with "\n"
, I need my terminal to show the Packs position fixed in place ( on the same row every time a new pack is printed) while the data inside the brackets are changing.
I don't mind having multiple output packs on the terminal at the same time, but I need them to be fixed in place and not jumping up and down the rows so I can read them while running the program.
Is there a way to ensure this in the terminal ?
I tried the following solutions:
- slowing down the print to terminal:
./out | watch -n 1 cat
This doesn't solve the problem. What I want is not slower streaming of data on my screen I don't want it to move up and down the lines on the terminal. this makes it move but at a slower rate.
- using grep to match a
flag
and print N
lines after:
./out | grep -AN flag
This doesn't solve the problem too, my guess is the at it appends the lines from the bottom of the terminal, and pushes the text up and does that one line at a time too. and what you endup seeing is a scrample on screen.
Thanks!