1#!/sw/bin/gawk -f 2 3function get_MHz(host, pipe, tmp, res, i) 4{ 5 tmp = ""; 6 res = ""; 7 pipe = "ssh -1 " host " psrinfo -v"; 8 while((pipe | getline tmp )>0) 9 { 10 if(i = index(tmp, mhz_string)) 11 { 12 print tmp, i 13 res = int(substr(tmp, i+mhz_string_l)) 14 break; 15 } 16 } 17 close(pipe); 18 19 return res; 20} 21 22 23BEGIN{ 24 mhz_string = "processor operates at "; 25 mhz_string_l = length(mhz_string); 26 print get_MHz("sunjessen5") 27 } 28