I'm new to AWK, can someone tell/show (example would be nice) me how to use a serial port an an input to awk. I would like to use AWK to sort the data on this port.
That is not an AWK question. AWK either reads from standard input or from a file you specify on the command line. You can reference a serial port both ways.<br>
Awk will close out as soon as it sees eof though, so a serial port without data on it will cause awk to prematurely close.<br>
You might be able to get around the lack of constant data on a serial port by using a construct like this:<br>
tail -f /dev/ttyXX ¦ awk -f "myawkscript"<br>
since tail will leave the pipe open even if nothing is on /dev/ttyXX, which represents your serial port device.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.