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.

Byla tato odpověď nápomocná?

 Tisknout tento článek

Také čtěte

DirectAdmin email forwarding not forwarding

Posted by river1, 06-30-2008, 07:20 AMI had email forwarding from a site that I am running on a...

Script PHP to check links automatically - backlink checker

Posted by JaneP, 10-22-2012, 12:08 PMHello forum Sometimes it is necessary to check every time...

Database design question: Indexing

Posted by phoqoo, 01-15-2008, 12:38 PMFrom what I've read, indexing columns helps optimize DB...

forums don't send to free mails like hotmail !

Posted by MrAdmin, 07-17-2007, 06:33 PMHi, Email on server working fine, I can send mails from...

remote reboot, how?

Posted by selbach, 05-06-2007, 07:59 AMnow, ive been looking at this but cant find out how to do...