awk -F, '
NR==1{
  for(i=1;i<=NF;i++){
    h=$i; gsub(/\r/,"",h)
    if(h=="RLI.new") rli=i
    if(h=="PHL.new") phl=i
    if(h=="country") country=i
    if(h=="iso") iso=i
  }
  next
}
{
  # RLI.new
  if(rli){
    v=$rli; gsub(/"/,"",v)
    if(v ~ /^[+-]?[0-9]*\.?[0-9]+([eE][+-]?[0-9]+)?$/){
      v+=0
      if(!rli_min_set || v<rli_min){ rli_min=v; rli_min_country=$(country); rli_min_iso=$(iso); rli_min_set=1 }
      if(!rli_max_set || v>rli_max){ rli_max=v; rli_max_country=$(country); rli_max_iso=$(iso); rli_max_set=1 }
    }
  }
  # PHL.new
  if(phl){
    w=$phl; gsub(/"/,"",w)
    if(w ~ /^[+-]?[0-9]*\.?[0-9]+([eE][+-]?[0-9]+)?$/){
      w+=0
      if(!phl_min_set || w<phl_min){ phl_min=w; phl_min_country=$(country); phl_min_iso=$(iso); phl_min_set=1 }
      if(!phl_max_set || w>phl_max){ phl_max=w; phl_max_country=$(country); phl_max_iso=$(iso); phl_max_set=1 }
    }
  }
}
END{
  if(rli){
    print "RLI.new min:", rli_min, " (", rli_min_iso, "-", rli_min_country, ")"
    print "RLI.new max:", rli_max, " (", rli_max_iso, "-", rli_max_country, ")"
  } else { print "naur col RLI.new" }
  if(phl){
    print "PHL.new min:", phl_min, " (", phl_min_iso, "-", phl_min_country, ")"
    print "PHL.new max:", phl_max, " (", phl_max_iso, "-", phl_max_country, ")"
  } else { print "naur col PHL.new" }
}
' epi_results_2024_pop_gdp.csv