标签:
腾讯一shell试题.
假设qq.tel文件内容:
12334:13510014336
12345:12334555666
12334:12343453453
12099:13598989899
12334:12345454545
12099:12343454544
分类如下:
[12334]
13510014336
12343453453
...........
[12099]
13598989899
12343454544
............
实现如下:
sort qq.tel| awk -F‘:‘ ‘{if(tmp!=$1) {tmp=$1;print "["tmp"]";} print $2;}‘ #tmp可以换成其他字符
标签:
原文地址:http://www.cnblogs.com/hanxing/p/4230898.html