From: Mischa POSLAWSKY Date: Thu, 5 Sep 2019 20:08:13 +0000 (+0200) Subject: strip trailing carriage returns X-Git-Tag: v1.02~3 X-Git-Url: http://git.shiar.nl/barcat.git/commitdiff_plain/a052b8d20f25e69c82104135c9925c17dcaa3eb3 strip trailing carriage returns Support CRLF line termination regardless of system record separator, preventing mangled output due to column returns before appended graphs. Besides Windows files, \r is also added by unbuffer -p for some reason. --- diff --git a/graph b/graph index eaafb76..e76ec64 100755 --- a/graph +++ b/graph @@ -39,7 +39,7 @@ $SIG{INT} = 'IGNORE'; # continue after assumed eof my (@lines, @values); while (readline) { - chomp; + s/\r?\n\z//; s/^\h*// unless $opt{unmodified}; push @values, s/^ ( \h* -? [0-9]* \.? [0-9]+ |)//x && $1; if (defined $opt{trim}) {