[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Grep and --color
From: |
Jori Mantysalo |
Subject: |
Grep and --color |
Date: |
Tue, 3 Jun 2003 09:29:14 +0300 (EEST) |
If I say
echo "aaaab" | grep -E --color=auto "((aaa)|(aa))*"
I get four red-colored a-letter, but with command
echo "baaaab" | grep -E --color=auto "((aaa)|(aa))*"
I just get gray text. So, grep finds match, but doesn't always color it.
What are the rules when matching with --only-match ? When I said
echo "aaaa" | grep -E --color=auto "((aaa)|(aa))"
I got four red-colored letter, but then when I said
echo "aaaa" | grep -E --color=auto -o "((aaa)|(aa))"
I got three red-colored letter and not two lines with two a:s in both.
So, is grep greedy or not when matching?
--
Jori Mäntysalo
- Grep and --color,
Jori Mantysalo <=