Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: pcre grep

by linuxer (Curate)
on Jun 10, 2010 at 20:43 UTC ( #844119=note: print w/ replies, xml ) Need Help??

in reply to pcre grep

I think, you could have a look at the official perldoc to get information about Perl's regular expressions:

perlretut - Tutorial

perlrequick - Quick Reference

perlre - Regex documentation

And not to forget the pcre man pages:

If you want/have to stick to pcregrep, I suggest something like:

pcregrep -v "^[^:]*:[^:]*:-?(1?\d?\d|20[0-4]):" /etc/passwd

It (simplified) assumes/uses:

  • the pattern is anchored at beginning of line (^)
  • "login name" field must not contain a colon
  • "password" field must not contain a colon
  • "UID" field:
    • leading optional "-"
    • grouped alternatives:
      • number between 0 and 199 OR
      • number between 200 and 204
  • don't care about the rest of the line

Comment on Re: pcre grep
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (9)
As of 2015-11-26 13:47 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (701 votes), past polls