in reply to Re5: Parsing 'uptime' output
in thread Parsing 'uptime' output

Thanks for the explanation. I agree with you but I still think the application of the principle in this case isn't merited.

If you want your computer to tell you how many seconds its been up...

Parsing it into seconds wasn't requested. I agree that it might be what was wanted. People often don't ask for what they really want. It is just as likely, however, that he wanted to display the English form on a web page or some such. In any case he wanted to collect the time, the number of users, and the load averages as well.

The fact remains that using uptime to retrieve these pieces of information provides a relatively stable and convenient interface and is able to be parsed by the same regex on at least the several platforms that I tested and probably many more. It might be a little messy (like a lot of the world) but Perl excels at dealing with messiness.

In defense of my Updates, all I can say is I got it right the first time but I retyped it wrong. Twice. I would have cut and pasted but I was using the console on a different machine. There really was no excuse for such sloppiness and I've put a link to the node on my home node as a reminder to myself to take my time and get it right. ;-)

-sauoq
"My two cents aren't worth a dime.";