Output of command in comma separated list

Hi;

I have an output of a particular command say

$command
fstl:r-x
ajay:r-x

how can i get this in comma separated list,
eg:

fstl:r-x,ajay:r-x

Thnks;

$ cat output
fstl:r-x
ajay:r-x
$ cat output | tr "\n" "," | sed 's/,$/ /' | tr " " "\n"
fstl:r-x,ajay:r-x
1 Like

Try...

 command | paste -s -d,
2 Likes

Thnks guys;

Alternate sed..

sed -n '1{h};1!{H};${g;s/\n/,/pg}' inputfile