Thanks PHV, so the block brackets need to appear as separate sed commands?
That fixes it for Solaris sed, but not Linux:
[tt]$ ls | sed -n '1h;1!H;${;g;y/\n/,/;p;}'
sed: -e expression #1, char 19: strings for y command are different lengths
$[/tt]
However this did work for me (^J entered using Ctrl-V, Ctrl-J in vi-editing mode):
[tt]$ ls | sed -n '1h;1!H;${;g;y/\^J/,/;p;}'[/tt]
And so did this:
[tt]$ ls | sed -n '1h;1!H;${;g;y/\
/,/;p;}'[/tt]
And to answer my other question, this changed the output back again:
[tt]$ ls | sed -n '1h;1!H;${;g;y/\^J/,/;p;}' | sed 'y/,/\^J/'[/tt]
Annihilannic.