> -----Original Message-----
>
> right now i do
>
> w | head -1
>
> and get what's below my signature. I want to clean that up, cutting it
> after the # of users, so that everything after AND including the third
> comma is removed from that line. Then take that and add it to my
> signature
> script.

Maybe I misunderstood.  I thought Ken was asking the opposite of what Jim
posted...


If you want a least effort solution, you can do it without perl.  Just
modify your bash script:

        w | head -1 | cut -d, -f1-3

A cleaner way would be to just use uptime, as Ken said:

        uptime | cut -d, -f1-3


Since it's a perl list, and you asked how to do it with perl...

There's probably a bazillion ways to accomplish this, but here's two ways:

Example 1:
----------
chomp($uptime = `uptime`);
$uptime =~ s/^([\w\s:]+(,[\w\s:]+){2}).*$/$1/;
print "$uptime\n";

Example 2:
----------
chomp($uptime = `uptime`);
$uptime = join(',',(split(/,/, $uptime, 4))[0,1,2]);
print "$uptime\n";


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to