Re: grep in cmd box

From: Bryan Dongray (btd_at_dongrays.com)
Date: 06/24/04

  • Next message: Bill Marcum: "Re: grep in cmd box"
    Date: Thu, 24 Jun 2004 10:18:24 GMT
    
    

    Sorry...

    Bryan Dongray wrote:
    > With perl you can do grep, eg:
    > netstat | perl -n -e 'if ($_ =~ /80/) {print $_;}'
    > would probably work.

    On a windows machine I tried this, but you need double quotes to
    make it work on a command line - or put the script in a file
    and call it from perl, eg "netstat | perl SCRIPT.PL"
    where SCRIPT.PL would contain:
            while ($l=<>) {
                    if ($l =~ /80/) {
                            print $l;
                    }
            }
    or similar.


  • Next message: Bill Marcum: "Re: grep in cmd box"

    Relevant Pages

    • Re: Net::DNS
      ... function because you still use $rr within the foreach, ... > So I can find the all these object methods in the perl docs listed below? ... > the return value of 'grep'. ... > perldoc perlboot ...
      (perl.beginners)
    • Re: Different way of getting Standard input
      ... If there are entries in @ARGV (the variable that holds what ... (e.g. grep, wc, sort, etc). ... die "$0 needs a pattern to match with" unless @ARGV; ... cowens@amans:~$ perl grep.pl perl grep.pl ...
      (perl.beginners)
    • Re: grep & regexp
      ... >I've tried several grep variants but unsuccessully. ... or perhaps perl (the double quotes below around ... the perl -e argument expand $variable from your shell, ... perlish for double quotes that makes it easier to do things like this from ...
      (comp.unix.sco.misc)
    • Re: references to OTHER objects
      ... > please don't think i don't try, but it's the searchign where i lose. ... >> I understand that perldoc can be sometimes lacking (I'm sure patches are ... I used 'grep' much more than perldoc until I was ... Of course you can use perl to do the same task as someone else as ...
      (comp.lang.perl.misc)
    • Re: OT: sed -n vs. sed
      ... > Bob Proulx wrote: ... The feature will be waiting there for you when you find the ... return code of grep is dependent upon whether it matched or not. ... The sed program predates perl by many years. ...
      (Debian-User)