The -s option is one of the useful, but lesser known feature of the paste command. It helps you to serialize input file contents to a single output line.

$ cat colors.txt

$ paste -sd, colors.txt

If multiple files are passed, serialization of each file is displayed on separate output lines.

$ paste -sd: <(seq 3) <(seq 5 9)

The advantage of using paste instead of other options like tr, awk, etc is that you do not have to worry about trailing delimiters, newlines, etc. For example:

# issue 1: trailing comma
# issue 2: no newline at the end
$ <colors.txt tr '\n' ','

# correcting the above two issues
$ <colors.txt tr '\n' ',' | sed 's/,$/\n/'

Here's an equivalent awk solution for single file input. While slower and complicated compared to the paste solution, you get more flexibility since awk is a programming language. For example, it is pretty easy to use multicharacter output delimiter.

$ awk -v ORS= 'NR>1{print ","} 1; END{print "\n"}' colors.txt

$ awk -v ORS= 'NR>1{print " : "} 1; END{print "\n"}' colors.txt
Blue : White : Orange

info See my paste command chapter from my Command line text processing with GNU Coreutils ebook for more details.

info See my GNU awk one-liners ebook if you are interested in learning about the awk command.