Transposing rows ⇄ columns in the clipboard (JS ES5 vs ES6 vs AS)

Here's another approach. It assumes each item is separated by a space.

image

awk -F',' '
{
  for (i=1; i<=NF; i++) {
    a[i,NR]=$i
    if (NF > max) max=NF
  }
  rowCount=NR
}
END {
  for (i=1; i<=max; i++) {
    for (j=1; j<=rowCount; j++) {
      printf "%s%s", a[i,j], (j<rowCount ? " " : "\n")
    }
  }
}'