Last active
August 29, 2015 14:05
-
-
Save tibotiber/ffca33cb7261e463928d to your computer and use it in GitHub Desktop.
log2csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo 'date,fsr1,fsr2,fsr3,fsr4,fsr5,fsr6,fsr7,fsr8,event' > 2014080${1}.csv | |
grep 'Preparing to post message: {' zigbee-gw2014080${1}.log | sed 's/[^{]*\({.*}\), to.*/\1/' | sed "s/'/\"/g" | sed 's/u"/"/g' | jq '"\(.date),\(.sample.R1),\(.sample.R2),\(.sample.R3),\(.sample.R4),\(\ | |
.sample.R5),\(.sample.R6),\(.sample.R7),\(.sample.R8),\(.value)"' | sed 's/null//g' | sed 's/"//g' >> 2014080${1}.csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
./log2csv.sh 5 | |
./log2csv.sh 6 | |
./log2csv.sh 7 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uses jq for json parsing in shell. So install it!