Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

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

by roboticus (Chancellor)
on Feb 01, 2013 at 02:31 UTC ( #1016424=note: print w/ replies, xml ) Need Help??


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

Tommy:

I'd do it like this:

$ grep -E '^[^#]*foo' boom now is the foo for all $ cat boom now is the foo for all now # foo is the blarg

...roboticus

When your only tool is a hammer, all problems look like your thumb.


Comment on Re: Grep'ping on Unix without perl-compatible gnu grep - can you do it better?
Download Code
Replies are listed 'Best First'.
Re^2: Grep'ping on Unix without perl-compatible gnu grep - can you do it better?
by Anonymous Monk on Feb 01, 2013 at 07:13 UTC
    Indeed, the -E switch (aka egrep) does activate a modern regexp syntax, and is found in a boatload more systems than where -P is. It does not come with all the Perl features, but it is way more comfortable than the basic 1980s dialect grep & co default to.
      You could (have) try(ied) awk on systems that has(had) a lacking grep.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (13)
As of 2015-07-29 11:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (263 votes), past polls