Jim Conner wrote:
>
> At 02:01 12.20.2001 -0500, Jim Conner wrote:
> >
> >At 00:26 12.20.2001 -0500, Steven Hetland wrote:
> > >
> > >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";
>
> Merged mine up with Steven's.
>
> perl -MShell -e 'print join(",",(split(/,/,uptime(),4))[0,1,2]),"\n"' <--
> very clean but kind of obfuscated
Or simply:
perl -le'print join",",(split/,/,`uptime`)[0..2]'
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]