From: David Neary (dneary at domain wanadoo.fr)
Date: Sun 29 Sep 2002 - 19:23:02 IST
Padraig Brady wrote:
> Can anyone explain the following
> (there should be no output from any of the greps below).
Well, that's obviously not true ;-)
Copied fileids to easier format...
> 1025:243:file1
> 243:1025:file2
> 243:243:file3
> [pixelbeat ~]$ echo -ne $file_ids | grep -E "(0|1|1025|0):(0|1|1025|0)"
Look for string of 0 or 1 or 1025 or 0 (matches line1 and line2)
followed by a colon (matches line1 and line2 still) followed by 0
or 1 or 1025 or 0 (the second 0 is redundant, by the way). Since
the matching string for line1 at the last time we matched (with
the following bits) was "1025:2" the match fails on the 2 there,
and for line2 it was "1025:f", so we fail there.
> [pixelbeat ~]$ echo -ne $file_ids | grep -E "(0|1|2|1025|0):(0|1|2|1025|0)"
> 1025:243:file1
The first () matches the 1025, followed by the colon, followed by
a match on 2 from the second ().
> [pixelbeat ~]$ echo -ne $file_ids | grep -E "(0|1|2|1025|0):(0|1|2|1025|0):"
The same as the previous line, but since the 2 in the previous
match wasn't followed by a colon, it no longer matches.
> [pixelbeat ~]$ echo -ne $file_ids | grep -E
> "(0|1|2|3|4|5|6|7|8|9|10|65534|1025|48|0):(0|1|2|3|4|5|6|7|8|9|10|65534|1025|48|0)"
> 1025:243:file1
> 243:1025:file2
> 243:243:file3
Line 1 matches because it containst the substring "5:2"
Line 2 matches on "3:1"
Line 3 matches "3:2"
> [pixelbeat ~]$ echo -ne $file_ids | grep -E
> "(0|1|2|3|4|5|6|7|8|9|10|65534|1025|48|0):(0|1|2|3|4|5|6|7|8|9|10|65534|1025|48|0):"
> 243:1025:file2
This matches the substring "3:1025:".
You'd have to explain what you're trying to do for me to
understand why you're expecting these not to match, and to give
an idea of how they should be fixed.
Cheers,
Dave.
--
David Neary,
Marseille, France
E-Mail: bolsh at domain gimp.org
This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:19:08 GMT