Shell Script Question

Posted by jscholes, 03-13-2010, 08:55 AM
Hi, I have a Windows port of the Unix/Linux uptime command. It shows system uptime, but not CPU load averages or the number of users logged on. Example: I want similar output from the uptime command on my Linux server. I know how to do this with PHP, using string split functions, but have no idea how to do it in a Bash script. I believe I'd have to use regexp in some way, shape or form, but I'm a complete newby when it comes to regexp. Can anyone please help me with this? Current output of uptime command on Linux: Desired output: Thanks.

Posted by PCS-Chris, 03-13-2010, 10:47 AM
Quick and dirty but try uptime | cut -c 1-27

Posted by jscholes, 03-13-2010, 11:51 AM
Great, worked like a charm. Its not being used in a production environment or anything, so quick and dirty was just what I needed. Thanks.

Bu cevap yeterince yardımcı oldu mu?

 Bu dökümanı yazdır

Also Read

Do I really need SpamAssassin?

Posted by dr00t, 09-18-2008, 03:26 AMI have a relatively low-end server that is running cPanel...

How to retrieve the total number of rows when using LIMIT X, XXX

Posted by yangyang2036, 09-17-2008, 10:09 PMWith php+mysql, $results -> num_rows returns the...

Removal of wget generated files

Posted by ladless, 09-19-2008, 03:19 PMHi there. I have several cronjobs set up like the...

litespeed standard 150 connect limit, high enough?

Posted by aww, 05-04-2007, 03:12 PMHow can I tell if the 150 connection limit in 3.1 litespeed is...

.htaccess problem

Posted by londonhogfan, 09-23-2008, 02:05 AMhi, I'm having quite a problem with my site on...