Linux/Unix command to join N lines of input with delimiters?
Don't know such built-in. Using Bash
you can:
while read a && read b && read c ; do echo $a,$b,$c ; done < file
That is horrible, surely something like
tr \\n ' '
would do the same thing?
So for e.g. to join lines of the file file_lines use
cat file_lines | tr \\n ' '
POSIX solution with pr
:
pr -3 -a -t -s, file
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/pr.html