grep -P regexp problem

Andriy Sen apsen@hotmail.com
Wed Mar 4 18:27:00 GMT 2009


> This is not cygwin-specific, so it is really OT for this list, that
> being said...
    Sorry. I will try to figure out where to go then.

> grep -P treats the whole input as a single string, and outputs the
> line (or lines) containing the match for the pattern.  [^0] matches 
> ANYTHING except 0, including linefeeds.

    I guess I oversimplified the regexp :-(

G:\>cat test.s | grep -P "^[^0]1"


G:\>cat test.s | grep -P "^(|[^0])1"
1

G:\>cat test.s | grep -P "^(|.*[^0])1"
a
1

Thanks,
Andriy
 

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list