bashshellnewlinetext-processing

Shell replace CR\LF by comma


I have input.txt

1
2
3
4
5

I need to get such output.txt

1,2,3,4,5

How to do it?


Solution

  • Try this:

    tr '\n' ',' < input.txt > output.txt