On 5/16/07, Srinivainputs <[EMAIL PROTECTED]> wrote:
Hi,

 ping geekcrossing.net|perl -le "m/time=(\d+)/;print $1";

Can some one help me with the above command

Add an n to the perl arguments to get it loop over stdin and use
single quotes to prevent shell from trying to interpolate $1.

ping geekcrossing.net|perl -nle 'm/time=(\d+)/;print $1';

Also, you should probably write it like this:

ping geekcrossing.net|perl -nle 'print /time=([\d.]+)/ ? $1 : "time not found"';

or this

ping geekcrossing.net|perl -nle 'print $1 if /time=([\d.]+)/';

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to