Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Grep'ping on Unix without perl-compatible gnu grep - can you do it better?

by kielstirling (Scribe)
on Feb 01, 2013 at 02:35 UTC ( #1016426=note: print w/ replies, xml ) Need Help??


in reply to Grep'ping on Unix without perl-compatible gnu grep - can you do it better?

perl -ne 'print if !/^#/ and /foo/' /tmp/foo.txt
is that what you want? Or using the regex for the above post
perl -ne 'print if /^[^#]*foo/' /tmp/foo.txt


Comment on Re: Grep'ping on Unix without perl-compatible gnu grep - can you do it better?
Select or Download Code
Re^2: Grep'ping on Unix without perl-compatible gnu grep - can you do it better?
by Tommy (Chaplain) on Feb 01, 2013 at 02:43 UTC

    Very nice...except you still have to account for potential preceeding whitespace before the hashmark /^[[:space:]]{0,}#/

    Tommy
    A mistake can be valuable or costly, depending on how faithfully you pursue correction

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1016426]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (9)
As of 2014-11-27 11:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (184 votes), past polls