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.

Помог ли вам данный ответ?

 Распечатать статью

Также читают

antivirus.exim

Posted by its_joy, 03-29-2008, 07:20 AMhi, i have installed antivirus.exim on server but if...

constantly blocked on pop3

Posted by Calibaba, 09-14-2007, 05:50 PMI just setup a new pop account in Outlook 2007 and...

Package Not Allowed or Exceeded Resource/Account Allocation

Posted by James-AgentBlack, 01-15-2008, 07:49 AMMirrored from whmcs forums, hope for a better...

Linux: backup hard drive mounted to /backup

Posted by UberTricep, 11-10-2012, 07:49 AMI have a new dedicated server and I ordered a backup...

MySQL database convert!

Posted by tetrahost, 11-14-2012, 03:25 AMHello all, i need a help from you. i need to convert a...