1611 shaares
17 private links
17 private links
It's an interesting dilemma. There are two obstacles to doing this in sed. One is that sed operates line by line and never sees the newline endings. Second, sed's regular expressions don't provide a way to exactly match a newline character.
If you really want to do this, don't use sed; use tr.
cat file | tr '\n' ','