BEGIN { FS = ","; # Initialize the field separator. OFS = ","; # Initialize the output field separator. } NR == 1 { #Set up arrays for conversion of values EM["apex_vl"]=1.22; EM["apex_l"]=1.10; EM["apex_n"]=1.00; EM["apex_h"]=0.88; EM["apex_vh"]=0.81; EM["plex_vl"]=1.19; EM["plex_l"]=1.09; EM["plex_n"]=1.00; EM["plex_h"]=0.91; EM["plex_vh"]=0.85; #Cocomo II precise data for the very low rating... SF["prec_vl"] = 6.20; SF["flex_vl"] = 5.07; SF["resl_vl"] = 7.07; SF["team_vl"] = 5.48; SF["pmat_vl"] = 7.80; EM["acap_vl"] = 1.42; EM["pcap_vl"] = 1.34; EM["pcon_vl"] = 1.29; EM["aexp_vl"] = 1.22; EM["pexp_vl"] = 1.19; EM["ltex_vl"] = 1.20; EM["tool_vl"] = 1.17; EM["site_vl"] = 1.22; EM["sced_vl"] = 1.43; EM["rely_vl"] = 0.82; EM["cplx_vl"] = 0.73; EM["docu_vl"] = 0.81; #Cocomo II precise data for the low rating... SF["prec_l"] = 4.96; SF["flex_l"] = 4.05; SF["resl_l"] = 5.65; SF["team_l"] = 4.38; SF["pmat_l"] = 6.24; EM["acap_l"] = 1.19; EM["pcap_l"] = 1.15; EM["pcon_l"] = 1.12; EM["aexp_l"] = 1.10; EM["pexp_l"] = 1.09; EM["ltex_l"] = 1.09; EM["tool_l"] = 1.09; EM["site_l"] = 1.09; EM["sced_l"] = 1.14; EM["rely_l"] = 0.92; EM["data_l"] = 0.90; EM["cplx_l"] = 0.87; EM["ruse_l"] = 0.95; EM["docu_l"] = 0.91; EM["pvol_l"] = 0.87; #Cocomo II precise data for the nominal rating... SF["prec_n"] = 3.72; SF["flex_n"] = 3.04; SF["resl_n"] = 4.24; SF["team_n"] = 3.29; SF["pmat_n"] = 4.68; EM["acap_n"] = 1.00; EM["pcap_n"] = 1.00; EM["pcon_n"] = 1.00; EM["aexp_n"] = 1.00; EM["pexp_n"] = 1.00; EM["ltex_n"] = 1.00; EM["tool_n"] = 1.00; EM["site_n"] = 1.00; EM["sced_n"] = 1.00; EM["rely_n"] = 1.00; EM["data_n"] = 1.00; EM["cplx_n"] = 1.00; EM["ruse_n"] = 1.00; EM["docu_n"] = 1.00; EM["time_n"] = 1.00; EM["stor_n"] = 1.00; EM["pvol_n"] = 1.00; #Cocomo II precise data for the high rating... SF["prec_h"] = 2.48; SF["flex_h"] = 2.03; SF["resl_h"] = 2.83; SF["team_h"] = 2.19; SF["pmat_h"] = 3.12; EM["acap_h"] = 0.85; EM["pcap_h"] = 0.88; EM["pcon_h"] = 0.90; EM["aexp_h"] = 0.88; EM["pexp_h"] = 0.91; EM["ltex_h"] = 0.91; EM["tool_h"] = 0.90; EM["site_h"] = 0.93; EM["sced_h"] = 1.00; EM["rely_h"] = 1.10; EM["data_h"] = 1.14; EM["cplx_h"] = 1.17; EM["ruse_h"] = 1.07; EM["docu_h"] = 1.11; EM["time_h"] = 1.11; EM["stor_h"] = 1.05; EM["pvol_h"] = 1.15; #Cocomo II precise data for the very high rating... SF["prec_vh"] = 1.24; SF["flex_vh"] = 1.01; SF["resl_vh"] = 1.41; SF["team_vh"] = 1.10; SF["pmat_vh"] = 1.56; EM["acap_vh"] = 0.71; EM["pcap_vh"] = 0.76; EM["pcon_vh"] = 0.81; EM["aexp_vh"] = 0.81; EM["pexp_vh"] = 0.85; EM["ltex_vh"] = 0.84; EM["tool_vh"] = 0.78; EM["site_vh"] = 0.86; EM["sced_vh"] = 1.00; EM["rely_vh"] = 1.26; EM["data_vh"] = 1.28; EM["cplx_vh"] = 1.34; EM["ruse_vh"] = 1.15; EM["docu_vh"] = 1.23; EM["time_vh"] = 1.29; EM["stor_vh"] = 1.17; EM["pvol_vh"] = 1.30; #Cocomo II precise data for the extra high rating... SF["prec_xh"] = 0.00; SF["flex_xh"] = 0.00; SF["resl_xh"] = 0.00; SF["team_xh"] = 0.00; SF["pmat_xh"] = 0.00; EM["site_xh"] = 0.80; EM["cplx_xh"] = 1.74; EM["ruse_xh"] = 1.24; EM["time_xh"] = 1.63; EM["stor_xh"] = 1.46; } #Replace any relevant field's data with the enumerated value. NF==4{ for(I=2; I<=NF; I++) { key=tolower($1)"_"tolower($I) #print "Key is " key #for (x in EM) #{ # print "key is " x " and EM is " EM[key] #} if (key in EM) { $I = EM[key]; #print "dollar I is " $I } else if (key in SF) { $I = SF[key]; } } print $0 } #END { key="acap_vl" # print EM[key] " from " key}