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;
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
Try...
command | paste -s -d,
Thnks guys;
Alternate sed..
sed -n '1{h};1!{H};${g;s/\n/,/pg}' inputfile