sort排序 awk去重

#按字段1排序,按字段2去重
sort -k1.1 $logfilepath | awk '!a[$2]++{print}' > outtestfileby2.log
#按字段1排序,按字段1去重
sort $logfilepath | awk '!a[$1]++{print}' > $outfilepath

#超简单的根据字段1来去重,但不排序
cat $logfilepath | awk '!a[$1]++' > $outfilepath

猜你喜欢

转载自shadowsocks.iteye.com/blog/901951