Source: http://stackoverflow.com/questions/1251999/how-can-i-replace-a-newline-n-using-sed
Replace with space:
Use this solution with GNU sed:
1 |
someoutput | sed ':a;N;$!ba;s/\n/ /g' |
Here is cross-platform compatible syntax which works with BSD sed (FreeBSD 8 confirmed):
1 |
someoutput | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/ /g' |
Replace with double dash:
Use this solution with GNU sed:
1 |
someoutput | sed ':a;N;$!ba;s/\n/--/g' |
Here is cross-platform compatible syntax which works with BSD sed (FreeBSD 8 confirmed):
1 |
someoutput | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/--/g' |