Our Computers Room is too hot today...

Similar problem as before, but with an important variation: I had to match just a small range of lines in the output of a command. This one-liner now runs on a Sun Ultra-Enterprise host running Solaris 8, and a monitoring software reads and reports the temperatures of the system boards.

/usr/platform/sun4u/sbin/prtdiag -v | perl -ne 'BEGIN { print "TABLE temperature\nSTART_SAMPLE_PERIOD\n" } ; END { print join ("NEXT_SAMPLE\n",@samples),"END_SAMPLE_PERIOD\nEND_TABLE\nSLEEP\n" } ; if (/^System Temperatures/../^$/) { next unless /^(CLK|\s*\d+)/ ; ($b,$t) = (split)[0,2] ; push @samples,"board=$b\ntemp=$t\n" }'

Have fun


In theory, there is no difference between theory and practice. In practice, there is.