Linux shell awk例子

2020-08-12 13:58:24
awk '{print $1}' *.txt | sort -g | uniq -c

拆解爲:
1 逐行讀取
awk '{print $1}' *.txt
2 逐行讀取&按照數位大小排序
awk '{print $1}' *.txt | sort -g
3 逐行讀取&按照數位大小排序&統計數量
數量在前,類目在後

 

refer:

https://www.cnblogs.com/ggjucheng/archive/2013/01/13/2858470.html

https://www.runoob.com/linux/linux-comm-awk.html