源文件为:
[root@luo5 wangxx]# cat -v luo.txt
J Luo
Soutth jfsa
Nanjing,china
Y Zhang
Victory University
Nejflja,Australia
D Hou
Beijing University
Melhouse,china
实现排序
[root@luo5 wangxx]# cat luo.txt |awk -v RS="" '{gsub("
","@");print}' | sort | awk -v OFS="
" '{gsub("@","
");print}'
D Hou
Beijing University
Melhouse,china
J Luo
Soutth jfsa
Nanjing,china
Y Zhang
Victory University
Nejflja,Australia