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 mövzu kifayət qədər köməkçi oldu mu?

 Çap

Digər Başlıqlar

PHP - check if file exists on a remote server

Posted by Gigaron, 01-16-2008, 03:08 AMI have my static files duplicated and spread over multiple...

MySQL SELECT using WHERE and OR

Posted by HostRefugee-Vince, 03-23-2007, 08:47 PMHi, The following SELECT statement is giving...

Suggest me a good book to lean server administration

Posted by servlet, 04-21-2009, 02:48 AMCan any one suggest me a good book that covers web server...

nsv streaming

Posted by kteo, 05-08-2007, 03:50 AMhello there...i have a shoutcast server installed in my...

How-To: PHP bbCode Function // Intermediate

Posted by JustinSmall, 09-21-2008, 03:49 PMIt wouldn't let me post this is the tutorial section,...