In Cygwin, I am trying to read serial port input, filter it to remove nul characters, and save the output to a file. Something like the following, which results in an empty logfile:
cat /dev/ttyS1 | tr -d '\000' >myfile.log
This shows stdout on the terminal:
cat /dev/ttyS1 | tr -d '\000'
I tried using stdbuf -oL -eL, per this post, to no avail.
Bonus points if you can get it to work with grep filtering stdout on the terminal (i.e., log everything to file, but only see filtered output on the terminal).
cat /dev/ttyS1 | tr -d '\000' | tee myfile.log | egrep --line-buffered "WARN|ERROR"
Note: The serial port I am using is an FTDI USB serial adapter.