I have a small script that cats the output from the ttyUSB to a file I would like to prepend a timestamp to each line. From the command line this does everything I want:
$ cat /dev/ttyUSB0 /home/pi/daily_logs/ttyUSSB0 | awk '{ print strftime("%Y-%m-%d %H:%M:%S"), $0; }
My issue is that when I add it to a script everything works but the awk timestamp isn't added. My script line looks like this:
cat < /dev/ttyUSB0 > /home/pi/daily_logs/ttyUSB0 | awk '{ print strftime("%Y-%m-%d %H:%M:%S"), $0; } &
Any help getting this going would be appreciated.