sanderjo / P1-OpenWrt

Connect Smart Meter P1 to OpenWrt / Slimme Meter P1 koppelen aan OpenWrt
GNU General Public License v2.0
1 stars 2 forks source link

large (14MB) file /tmp/teller5 #1

Open sanderjo opened 9 years ago

sanderjo commented 9 years ago

The temp file /tmp/teller5 is large (14MB); filled with control characters.

-rw-r--r--    1 root     root      14830788 Jul 25 14:03 /tmp/teller5

Because OpenWrt has no od / hd, hard to see which characters.

A tr solves this:

root@OpenWrt:~# cat /tmp/teller5  | tr -d '\000\001\002\003\004\005\006\007\010\011\013\014\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037' | grep -vi '^$'  > /tmp/teller-clean.txt

root@OpenWrt:~# ls -al /tmp/teller*
-rw-r--r--    1 root     root          9305 Jul 25 14:08 /tmp/teller-clean.txt
-rw-r--r--    1 root     root      14832389 Jul 25 14:08 /tmp/teller5
sanderjo commented 9 years ago

Getting the file to a Ubuntu, and then doing a 'hd', shows a lot of zero's (00e185c0 to be precise))

$ hd teller5-example.txt | head -4
00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00e185c0  0a 0a 30 2d 30 3a 39 36  2e 31 2e 31 28 32 30 34  |..0-0:96.1.1(204|
00e185d0  42 34 31 33 36 35 35 33  30 33 30 33 31 33 37 33  |B413655303031373|

So a cat /tmp/teller5 | tr -d '\000' | grep -vi '^$' solves it.

sanderjo commented 9 years ago

Or, better: do not use "crtscts" in the stty