1# fetch version number from input file and write them to STDOUT 2BEGIN { 3 while ((getline < ARGV[1]) > 0) { 4 if (match ($0, /^VERSION=/)) { 5 split($1, t, "="); 6 my_ver_str = t[2]; 7 split(my_ver_str, v, "."); 8 gsub("[^0-9].*$", "", v[3]); 9 my_ver = v[1] "," v[2] "," v[3]; 10 } 11 } 12 print "GEOIP_VERSION = " my_ver ""; 13 print "GEOIP_VERSION_STR = " my_ver_str ""; 14} 15