#!/bin/bash declare -i n=1 a=`head -n 1 nowcoder.txt | awk "{print NF}"` b=`awk "END {print NR}" nowcoder.txt` # sort -k 2 nowcoder.txt -o nowcoder.txt # 没看懂这个词频排序是什么排序规则 while [ $n -le $a ] do awk '{printf "%s ",$'$n'}' nowcoder.txt echo '' let n+=1 done