本帖最后由 buyiyang 于 2023-6-3 21:14 编辑
- gawk "{a[$1][FNR]=$0;if (!($1 in order)) {order[length(order) + 1] = $1}} END {for (i = 1; i <= length(order); i++) {n = asorti(a[order[i]], b);for (j = 1; j <= n;j++) {if (!(a[order[i]][b[j]] in s)) {print a[order[i]][b[j]];s[a[order[i]][b[j]]] = 1}}}}" 1.txt > 2.txt
复制代码
|