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.

Hjälpte svaret dig?

 Skriv ut denna artikeln

Läs även

subdomain and directory question

Posted by azn_romeo_4u, 03-27-2008, 01:02 AMHow do those websites do a website like this....

utterly confused about external links?

Posted by gg2327, 09-14-2007, 11:02 PMhave a few different list of links in my link section for...

Setting up databases?

Posted by NotoriousKIM, 05-07-2007, 01:15 AMDoes anyone know anything about how to set up a mysql...

Trojan detected on initial load of site

Posted by geekie246, 01-08-2008, 02:10 PMHi. I have 2 reseller accounts with one provider, and...

upgrade MySql and PHP

Posted by paul-naama, 09-16-2007, 04:55 AMApparently because i wanted LXADMIN HIAB they had to...