redirect executable progress bar to log file

bash, io-redirection, linux-kernel, shell

Solution

A related answer on a different site, suggests the `col` command.

To suppress overwritten output on standard out prior to writing to the file:

usr/bin/exec | col -b >> log.txt

To view the contents of a file while suppressing overwritten characters:

col -b < log.txt | less

Your progress bar probably works by using a carriage return to signal that the current line should be overwritten. The `col` utility buffers the output so that it can print only the last character for each position.

Problem

I have an Executable which shows progress bar on terminal. when i redirect the output to a file in th ebelow manner the below command is embedded in a script file ``` usr/bin/exec >> log.txt ``` this is terminal out put ``` Progress [====================================> ] 58% ``` But the log.txt looks some thing like this ``` Progress [=> ] 0 Progress [====> ] 5 Progress [========> ] 10 ``` can i redirect the output in same way as it is shown on terminal.

Original source