Reputation: 1087
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.
Upvotes: 1
Views: 6078
Reputation: 231213
Pipe it through perl in a no-op line-buffered mode:
perl -pe 1 /dev/whatever
Upvotes: 1
Reputation: 3678
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.
Upvotes: 4
Reputation: 798764
No, but GNU grep with --line-buffered
can do this. Just search for something every line has, such as '^'
.
Upvotes: 3