Good Good Study. Day Day Up.
分类: LINUX
2016-01-07 20:16:42
# cat 1.txt 2.1.10.1 2.1.10.2 2.11.0.1 2.11.0.2 |
# awk 'BEGIN{FS=OFS="."}{if(!a[$1.$2.$3]++)print}' 1.txt 2.1.10.1 # awk -F '.' '{a[$1.$2.$3]++;}END{for(i in a)print i" "a[i]}' 1.txt 2110 4 |
# awk 'BEGIN{FS=OFS="."}{if(!a[$1"."$2"."$3]++)print}' 1.txt 2.1.10.1 2.11.0.1 # awk -F '.' '{a[$1"."$2"."$3]++;}END{for(i in a)print i" "a[i]}' 1.txt 2.11.0 2 2.1.10 2 |