I have a file output.txt
containing a cURL progress output like
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 490M 0 0 0 208k 0 248k 0:33:43 --:--:-- 0:33:43 248k
0 490M 0 0 0 256k 0 157k 0:53:11 0:00:01 0:53:10 157k
0 490M 0 0 0 368k 0 140k 0:59:49 0:00:02 0:59:47 140k
3 490M 0 0 3 19.5M 0 155k 0:53:50 0:02:08 0:51:42 153k
3 490M 0 0 3 19.6M 0 154k 0:54:05 0:02:09 0:51:56 141k
4 490M 0 0 4 19.7M 0 154k 0:54:06 0:02:10 0:51:56 120k
I would ONLY like to extract the last line. When I do:
LASTLINE=$(tail -n1 output.txt)
It is apparent that even tho
echo $LASTLINE
shows the last line, it contains everything as evidence by:
echo "${#LASTLINE}"
which shows 709
, the count of the number of characters, but the last line should only have 79 characters. I understand this is something about buffers. What is going on?