https://leetcode.com/problems/transpose-file/description/
列行转换
For example, if file.txt has the following content:
name age
alice 21
ryan 30
Output the following:
name alice ryan
age 21 30
#!/bin/bash
awk '{for (i = 1; i <= NF; ++i) {if (NR == 1) {row[i] = $i;} else {row[i] = row[i]" "$i;}}}; END {for (i = 1; i <= NF; ++i) print row[i];}' file.txt