本帖最后由 pcl_test 于 2016-7-18 19:41 编辑
有文本a.txt,内容如下- AAA,BBB,CC,D,EEEEEEEE,950
- SSS,GGG,CC,F,EEEEEEEE,1000
- SSS,GGG,CC,F,EEEEEEEE,800
- PPP,YYY,FF,E,DDDDDDDD,1250
- KKK,JJJ,HH,D,TTTTTTTT,400
- KKK,JJJ,HH,D,TTTTTTTT,1200
- KKK,JJJ,HH,D,TTTTTTTT,800
复制代码 文件中存在以下情况,2条以上的记录前5项相同,最后1项不同,如:
SSS,GGG,CC,F,EEEEEEEE,1000
SSS,GGG,CC,F,EEEEEEEE,800
KKK,JJJ,HH,D,TTTTTTTT,400
KKK,JJJ,HH,D,TTTTTTTT,1200
KKK,JJJ,HH,D,TTTTTTTT,800
希望输出结果:
AAA,BBB,CC,D,EEEEEEEE,950
SSS,GGG,CC,F,EEEEEEEE,1000
PPP,YYY,FF,E,DDDDDDDD,1250
KKK,JJJ,HH,D,TTTTTTTT,1200
即:
1、前5项没有相同记录的,直接输出;
2、前5项有相同记录的,输出第6项数字最大的记录。
希望高手指点,谢谢! |