Calculating Wake time

Accoring this article, http://osxdaily.com/2011/07/14/get-exact-boot-sleep-and-wake-times-from-the-command-line/, it ipossibel to exactly calculate the wake up time of the mac using some grep commands.

I was thinking to get the results of the grep commands to KM variables.

kern.waketime: { sec = 1310573055, usec = 11 } Wed Jul 13 09:04:15 2011

I don’t know how to get that specific 1310573055 part out of the long output.

It is possible to run regex search on the result of a grep command in the first place?

Any help would be appriciated.

If you save the output of the shell script to a variable, you then run the variable through a Search using Regular Expression action to extract the meaty part. Like this:

Shell Scripting.kmmacros (3.4 KB)

2 Likes

thanks; exactly!