Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'A script to measure idle time on input devices' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A script to measure idle time on input devices
Authored by: clith on Apr 06, '04 09:31:05AM
In Perl, that's:
ioreg -c IOHIDSystem | perl -ane 'if(/Idle/) {$idle=(pop @F)/1000000000; print $idle, "\n"; last;}'
sed just looks so ... awkward. :-)

[ Reply to This | # ]
easier with awk
Authored by: daniel_steffen on Apr 07, '04 04:30:54AM

FWIW, in this case, awk is actually easier than sed or perl IMO...

ioreg -c IOHIDSystem | awk '/HIDIdleTime/ {print $NF/1000000000; exit}'

[ Reply to This | # ]