Notice that this question is distinctly different from How do I get cURL to not show the progress bar? though a valid answer to this question would likely suffice this comment on that other question.
I have a script that is logging cURL's stderr to a file. We'll use this as an example:
curl -Lo /dev/null stackoverflow.com 2>/tmp/foo
When I inspect that file, it looks like this:
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
^M  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0^M100   143  100   143    0     0   1190      0 --:--:-- --:--:-- --:--:--  1191
^M 97  244k   97  239k    0     0   688k      0 --:--:-- --:--:-- --:--:--  688k^M100  244k  100  244k    0     0   701k      0 --:--:-- --:--:-- --:--:-- 4974k
And that's total garbage to me. I want the statistics without the animated progress bar. I can parse it out with some standard unix tools. However, I'm thinking maybe some combination of arguments and/or termcap/terminfo may also work.
Please advise.
This simple post processing would work because it's not animated:
head -n2 /tmp/foo; tail -n1 /tmp/foo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  245k  100  245k    0     0   393k      0 --:--:-- --:--:-- --:--:--  393k
 
    