Script to find min for each unique value

I need a script that will search through multiple files and when the first 2 columns match, print out Columns 1 and 2 and the minimum value.

File 1

24.01  -81.01    1.0
24.02  -81.02    1.0
24.03  -81.03    3.0

File 2

24.01  -81.01    5.0
24.02  -81.02    3.0
24.03  -81.03    1.0

File 3

24.01  -81.01   -1.0
24.02  -81.02    5.0
24.03  -81.03    0.0

Expected output

24.01  -81.01   -1.0
24.02  -81.02    1.0
24.03  -81.03    0.0

Try:

awk '{n=$3; $3=x} !($0 in A) || n<A[$0] {A[$0]=n} END{for(i in A) print i A}' file* | sort -n 

The above script does not seem to be working for me when used in the following way -


for year in "${file}"/{1950..2015}01.pnt 
do
cat "$year"
done |
awk '{n=$3; $3=x} !($0 in A) || n<A[$0] {A[$0]=n} END{for(i in A) print i A}' > output.txt

I need it to search through all the January's in years 1950-2015 and grep out the minimum value in Column 3 of each unique value contained in Columns 1 and 2.

Any suggestions?

I don't see any reason why Scrutinizer's script should not work on your scenario unless the structure of the files in your directories differs from the one posted as samples in post#1.