行转列(awk):
awk -F "+" '{for(i=1;i<=NF;i++) a[i,NR]=$i}END{for(i=1;i<=NF;i++) {for(j=1;j<=NR;j++) printf a[i,j] " ";print ""}}' file.txt
awk 'BEGIN{i=1}{gsub(/#/,"\t"i"\n");i++;print}' uids|sed '/^$/d' > uids_seg
列转行(tr):
cat file.txt |tr "\n" ","|sed -e 's/,$/\n/'