Use GNU.
echo 'A:B:C' | sed 's/:/\n/g'
A
B
C
No wonder. understandable.
- sed (GNU sed) 4.4
- docker run --interactive --tty ubuntu /bin/bash
echo 'A:B:C' | sed 's/:/\
/g'
A
B
C
or
echo 'A:B:C' | sed -e 's/:/\'$'\n/g'
A
B
C
Are you really?
I don’t know what does mean '$'
and don’t wanna understand.
- Mac OS X High Sierra
- GNU bash, version 4.4.0(1)-release (x86_64-apple-darwin15.6.0)
All examples does not work well as I expected.
echo 'A:B:C' | sed -e 's/:/\n/g'
AnBnC
echo 'A:B:C' | sed 's/:/\n/g'
AnBnC
echo 'A:B:C' | sed 's/:/\\n/g'
A\nB\nC
echo 'A:B:C' | sed 's/:/\r/g'
ArBrC
echo 'A:B:C' | sed 's/:/\\r/g'
A\rB\rC
echo 'A:B:C' | sed "s/:/\n/g"
AnBnC
echo 'A:B:C' | sed "s/:/\\n/g"
AnBnC
echo 'A:B:C' | sed "s/:/\\r/g"
ArBrC
echo 'A:B:C' | sed "s/:/\r/g"
ArBrC
echo 'A:B:C' | sed "s/:/\r\n/g"
ArnBrnC
echo 'A:B:C' | sed "s/:/\\r\\n/g"
ArnBrnC
echo 'A:B:C' | sed "s/:/\\\r\\\n/g"
A\r\nB\r\nC