[EMAIL PROTECTED] wrote:
> grep -o [1234567890]* grepbug-onlymatching.txt

It is indeed puzzling that the above doesn't produce any output.  
But in a sense the -o and the * are conflicting: the [1234567890]* 
will match anything, also zero digits, and the -o should then print 
all these occurrences of zero digits...

It works when you change the regular expression to be more specific: 
you don't really want to match zero occurrences of a digit, but 
only one or more: 

  grep -o "[1234567890]\+" grepbug-onlymatching.txt

or

  grep -Eo [1234567890]+ grepbug-onlymatching.txt

(Why the quotes are needed in the first alternative is beyond me.)
  
Benno


Reply via email to