0

I'm using a Raspberry Pi with a Serial device connected over USB (/dev/ttyACM0). I can write the data to the console with cat /dev/ttyACM0.

But when I try to replace the $ signs in the output with a newline cat /dev/ttyACM0 | sed 's/\$/\n/g' i get no output.

When I write the output of cat to a file and then replace the $ signs with cat file | sed 's/\$/\n/g' it works.

Is there any option for sed that it will work?

heysamhey
  • 530
  • 1
  • 6
  • 17

2 Answers2

2

Try sed's option --unbuffered.

Cyrus
  • 84,225
  • 14
  • 89
  • 153
2

Try this I'm pretty sure that it will work,

cat /dev/ttyACM0 | tr '$' '\n' 
Arnab Nandy
  • 6,472
  • 5
  • 44
  • 50