输入文件
0.020003 3
0.122203 3
0.122324 3
0.122445 3
0.122566 3
0.203582 43
0.225691 3
0.225812 3
0.226899 3
0.22702 3
0.228107 3
0.228228 3
0.229315 3
0.229436 3
0.325978 5
0.329179 3
0.3293 3
0.330387 3
0.330508 3
0.331595 3
0.331716 3
0.332803 3
0.332924 3
0.334011 3
0.334132 3
0.335219 3
0.33534 3
0.336427 3
0.336548 3
0.337635 3
0.337756 3
0.345776 43
0.345897 43
0.346018 43
0.346138 43
0.430173 5
0.430294 5
0.430414 5
0.430535 5
0.432667 3
0.432788 3
0.433875 3
0.433996 3
0.435083 3
0.435204 3
0.436291 3
0.436412 3
0.437499 3
0.43762 3
0.438707 3
0.438828 3
0.439915 3
0.440036 3
0.441123 3
0.441244 3
0.442331 3
0.442452 3
0.443539 3
0.44366 3
0.444747 3
0.444868 3
0.445955 3
0.446076 3
0.447163 3
0.447284 3
0.448371 3
0.448492 3
0.449579 3
0.4497 3
0.450787 3
0.450908 3
0.491995 43
0.492116 43
0.493203 43
0.493324 43
0.494411 43
0.494532 43
0.495619 43
0.49574 43
0.509831 103
0.535661 5
0.535782 5
0.536869 5
0.53699 5
0.538077 5
0.538198 5
0.538493 3
0.538614 3
0.539285 5
0.539406 5
0.539701 3
0.539822 3
0.540909 3
0.54103 3
0.542117 3
0.542238 3
0.543325 3
0.543446 3
0.544533 3
0.544654 3
0.545741 3
0.545862 3
0.546949 3
0.54707 3
0.548157 3
0.548278 3
0.549365 3
0.549486 3
0.550573 3
0.550694 3
0.551781 3
0.551902 3
0.552989 3
0.55311 3
0.554197 3
0.554318 3
0.555405 3
0.555526 3
0.556613 3
0.556734 3
0.557821 3
0.557942 3
0.559029 3
0.55915 3
0.560237 3
0.560358 3
0.561445 3
0.561566 3
0.562653 3
0.562774 3
0.563861 3
0.563982 3
0.565069 3
0.56519 3
0.566277 3
0.566398 3
0.567485 3
0.567606 3
0.568693 3
0.568814 3
0.569901 3
0.570022 3
0.571109 3
0.57123 3
0.572317 3
0.572438 3
0.573525 3
0.573646 3
0.574733 3
0.574854 3
0.575941 3
0.576062 3
0.635483 43
0.635604 43
0.636691 43
0.636812 43
0.637899 43
0.63802 43
0.639107 43
0.639228 43
0.640315 43
0.640436 43
0.641149 5
0.64127 5
0.641523 43
0.641644 43
0.642357 5
0.642478 5
0.642731 43
0.642852 43
0.643565 5
0.643686 5
0.643939 43
0.64406 43
0.644773 5
0.644894 5
0.645981 5
0.646102 5
0.646397 3
0.646518 3
0.647189 5
0.64731 5
0.647605 3
0.647726 3
0.650813 5
0.650934 5
0.651229 3
0.65135 3
0.652021 5
0.652142 5
0.652437 3
0.652558 3
0.653645 3
0.653766 3
0.654853 3
0.654974 3
0.656061 3
0.656182 3
0.657269 3
0.65739 3
0.658477 3
0.658598 3
0.659685 3
0.659806 3
0.660893 3
0.661014 3
0.662101 3
0.662222 3
0.663309 3
0.66343 3
0.664517 3
0.664638 3
0.665725 3
0.665846 3
0.666933 3
0.667054 3
0.668141 3
0.668262 3
0.669349 3
0.66947 3
0.670557 3
0.670678 3
0.671765 3
0.671886 3
0.672973 3
0.673094 3
0.674181 3
0.674302 3
0.675389 3
0.67551 3
0.676597 3
0.676718 3
0.677805 3
0.677926 3
0.679013 3
0.679134 3
0.680221 3
0.680342 3
0.681429 3
0.68155 3
0.682637 3
0.682758 3
0.683845 3
0.683966 3
0.685053 3
0.685174 3
0.686261 3
0.686382 3
0.687469 3
0.68759 3
0.688677 3
0.688798 3
0.689885 3
0.690006 3
0.691093 3
0.691214 3
0.692301 3
0.692422 3
0.693509 3
0.69363 3
0.694717 3
0.694838 3
0.695925 3
0.696046 3
0.697133 3
0.697254 3
0.698341 3
0.698462 3
0.699549 3
0.69967 3
0.700757 3
0.700878 3
0.701965 3
0.702086 3
0.703173 3
0.703294 3
0.704381 3
0.704502 3
0.705589 3
0.70571 3
0.706797 3
0.706918 3
0.708005 3
0.708126 3
0.709213 3
0.709334 3
0.710421 3
0.710542 3
0.711629 3
0.71175 3
0.712025 103
0.712146 103
0.712267 103
0.712388 103
0.712837 3
0.712958 3
0.714045 3
0.714166 3
0.715253 3
0.715374 3
0.716461 3
0.716582 3
0.717669 3
0.71779 3
输出文件
0.020003 3
0.020003 3
0.020003 3
0.020003 3
0.020003 3
0.203582 43
0.020003 3
0.203582 43
0.020003 3
0.203582 43
0.020003 3
0.203582 43
0.020003 3
0.203582 43
0.020003 3
0.203582 43
0.020003 3
0.203582 43
0.020003 3
0.203582 43
0.020003 3
0.203582 43
0.020003 3
0.325978 5
0.203582 43
0.020003 3
0.325978 5
0.203582 43
0.020003 3
0.325978 5
0.203582 43
0.020003 3
0.325978 5
0.203582 43
0.020003 3
0.325978 5
0.203582 43
0.020003 3
0.325978 5
0.203582 43
0.020003 3
0.325978 5
0.203582 43
0.020003 3
0.325978 5
0.203582 43
0.020003 3
0.325978 5
0.203582 43
0.020003 3
0.325978 5
0.203582 43
0.020003 3
0.325978 5
0.203582 43
0.020003 3
0.325978 5
0.203582 43
0.020003 3
0.325978 5
0.203582 43
0.020003 3
0.325978 5
0.203582 43
0.020003 3
0.325978 5
0.203582 43
0.020003 3
0.325978 5
0.203582 43
0.020003 3
0.325978 5
0.203582 43
0.020003 3
0.325978 5
0.203582 43
0.020003 3
0.325978 5
0.203582 43
0.020003 3
0.325978 5
0.203582 43
0.020003 3
0.325978 5
0.203582 43
0.020003 3
0.325978 5
0.203582 43
0.020003 3
0.325978 5
0.203582 43
0.020003 3
0.325978 5
0.203582 43
0.020003 3
0.325978 5
0.203582 43
0.020003 3
0.325978 5
0.203582 43
0.020003 3
我需要输出文件
0.020003 3
0.325978 5
0.203582 43
0.509831 103
每一行都在原始文件和错误的输出文件中重复
答案 0 :(得分:0)
我的回答仍然有效:duplicate
awk '!a[$2]||a[$2]>$1 {a[$2]=$1} END {for (i in a) print a[i],i}' file
0.325978 5
0.509831 103
0.203582 43
0.020003 3
这有效:
awk '!a[$2]++' file
0.020003 3
0.203582 43
0.325978 5
0.509831 103