File: test.awk

package info (click to toggle)
eprover 3.2.5%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 14,504 kB
  • sloc: ansic: 104,396; csh: 13,135; python: 11,207; awk: 5,825; makefile: 554; sh: 400
file content (27 lines) | stat: -rwxr-xr-x 448 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/opt/local/bin/gawk -f

function get_MHz(host,   pipe, tmp, res, i)
{
  tmp = "";
  res = "";
  pipe = "ssh -1 " host " psrinfo -v";
  while((pipe | getline tmp )>0)
  {
     if(i = index(tmp, mhz_string))
     {
	print tmp, i
	res = int(substr(tmp, i+mhz_string_l))
	break;
     }
  }
  close(pipe);  

  return res;
}


BEGIN{
   mhz_string = "processor operates at ";
   mhz_string_l = length(mhz_string);
   print get_MHz("sunjessen5")
    }