'\n' in the replace pattern in sed command doesn't work in Mac OS X.
On Debian, we can get bellowing result:
root# echo abc | sed 's/[^\n]/&\n/g'abc root#
But on Mac, it goes like this:
user$ echo abc | sed 's/[^\n]/&\n/g'anbncnuser$
Solution is to add \'$' before \n as bellowing:
user$ echo abc | sed 's/[^\n]/&\'$'\n/g'abc user$
Please refer to for more detail discussion.
But i tried another method sed 's/[^\n]/&\\\n/g' metioned in the discussion, it didn't work on my machine.