How do I convert carriage returns from a text file to the way they are displayed in console?
So for example, if a program prints the following lines to a console:
start\n
progress 01%\r
progress 22%\r
progress 54%\r
progress 100%\n
completed
after a time the output in the console will look like this:
start
progress 100%\n
completed
but if I pipe the output to a file it will contain all the intermediate progress reports.
Preferably some solution that can be applied to large log files >100 MB.
progress 22%
that would be overwritten otherwise because of the\r
without\n
. The belowcol
answer already solved my issue but I couldn't yet (2 day timeout) mark it as the answer.1234\r
followed with321\n
the end result in the console would be3214\n
. If you remove lines with carriage returns, the result would be321\n
.