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.

هل استفدت من هذا الجواب؟

 أطبع هذا المقال

اقرأ أيضا

Error when editing dns Zone

Posted by htw_Mehdi, 06-27-2008, 10:33 AMHello, when i try to edit a DNS zone on WHM i got the...

CMS for File Management?

Posted by Sammy89, 02-18-2011, 05:27 PMis there a php app out there that allows you up...

user avahi

Posted by sherwood, 04-22-2009, 11:59 AMHi, I seem to be getting emails from LFD about the...

Joomla HELP!

Posted by Snitz, 09-15-2008, 12:33 PMI'm having a weird problem here. I'm using MusicBox 2.0...

SSL Certificate works for folders?

Posted by Energizer Bunny, 01-13-2008, 06:10 AMHi, Say i have domain zzzzz.com and have some...