correct stripping of ascii dump
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 3 Oct 2020 18:09:38 +0000 (20:09 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 3 Oct 2020 18:09:38 +0000 (20:09 +0200)
unpack.pl

index 9ffb3ec..0251ba8 100755 (executable)
--- a/unpack.pl
+++ b/unpack.pl
@@ -9,6 +9,8 @@ use Protocol;
 
 my $debug = $ENV{DEBUG};
 
+$| = 1;
+
 warn "## protocol = ",dump( $protocol ) if $debug;
 
 my $pkg_nr = 0;
@@ -157,8 +159,8 @@ while(<>) {
                ( $timestamp, $sensor, $imei, $up_down ) = ( $1, $2, $3, $4 );
                $stat->{$sensor}->{$imei}->{$up_down}++;
        } elsif ( m{^\s+} ) {
-               s/\s\s\S\S\S+//g; # remove ascii
                s/^\s+/ /;
+               s/\s\s.+$//g; # remove ascii
                $raw .= $_;
                warn "++ $_\n";
        } else {