BEGIN { minimum_iout_th = 20000; iout_th = 0; minimum_reached = 0; value1 = 0; value2 = 0; } { if( $1 == "iout_th" ) { iout_th = 1; getline; if( $1 >= minimum_iout_th ) { minimum_reached = 1; } } if( minimum_reached == 1 && $1 == "rreac_th" ) { #read the 13th value getline; getline; getline; value1 = $3; #change xDy notation to xEy notation sub( "D", "E", value1 ); #read the 36th value getline; getline; getline; getline; getline; value2 = $1; #change xDy notation to xEy notation sub( "D", "E", value2 ); print value1 " " value2; } } END { }