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.

Was this answer helpful?

 Print this Article

Also Read

No right click code

Posted by rumrunner439, 09-22-2008, 11:07 AMOk i saw some code that i though would stop right...

Redirect domain/user to user.domain ONLY IF folder 'user' doesn't exist

Posted by ThatScriptGuy, 05-07-2007, 04:22 PMWell, I thought I knew enough about my .htaccess...

Autoplay mp3 on page load

Posted by bambinou, 11-16-2012, 07:12 AMHello, I have a 5 second greeting mp3 I would like to...

javascript dies in php

Posted by ti_nhatrang, 01-17-2008, 06:49 AMHi guys, I can't seem to put this in a echo...

Apache/MySQL/PHP Issue - PHP not loading.

Posted by Darkfire001, 06-28-2008, 01:36 PMHi Guys, Any and all help is appreciated. I've got...