is there a way to do line-bufferd cat? For example, I want to watch a UART device, and I only want to see it's message when there is a whole line. Can I do some thing like:
cat --line-buffered /dev/crbif0rb0c0ttyS0
Thanks.
is there a way to do line-bufferd cat? For example, I want to watch a UART device, and I only want to see it's message when there is a whole line. Can I do some thing like:
cat --line-buffered /dev/crbif0rb0c0ttyS0
Thanks.
You can also use bash to your advantage here:
cat /dev/crbif0rb0c0ttyS0 | while read line; do echo $line; done
Since the read
command reads a line at a time, it will perform the line buffering that cat
does not.
No, but GNU grep with --line-buffered
can do this. Just search for something every line has, such as '^'
.
Pipe it through perl in a no-op line-buffered mode:
perl -pe 1 /dev/whatever