Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
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 chanting in the Monastery: (6)
As of 2014-09-17 07:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (62 votes), past polls