I have a script which does hexdump along with pipeline commands and finally I am redirecting it to a file. Now I am logging data from the serial port of my Raspberry Pi. I also call a python script(display time in milliseconds) from the shell script. I takes like 5 minutes for me to see the data on screen after I run the command.
timeout 2s ./ExpHmax
while :
do
sudo hexdump -v -e '1/1 "%02x\n"' /dev/ttyUSB0 | awk '$1=="ed" {
getline byte1
getline byte2
number = strtonum("0x" substr(byte2,2,1))+2
"./Time.py" |& getline timestamp;
data = ":: "timestamp " ::ED." byte1"."byte2
while(number-->0)
{getline byte; data = data"."byte}
print data"."
}' | tr '[a-z]' '[A-Z]'| grep -v '^.....................00' > Thur.log
done
Can anyone suggest me a way to do this script without doing the pipe. I guess that's causing the delay. Here is my Python script
import time
millis = int(round(time.time() * 1000))
print millis