Public bug reported:
Binary package hint: grep
> lsb_release -rd
Description: Ubuntu maverick (development branch)
Release: 10.10
I'm using maverick beta that contains grep 2.6.3.
When using the '--include' option to grep (mainly used for recursive
matching), grep 2.6.3 does not behave as expected. In fact, it works
like '--exclude', but only in the top level directory.
Example:
1. Create a subdirectory that contains two files "file.has" and "file.hasnot".
Both files contain only the string 'test'.
>mkdir test
>cd test
>echo "test" > file.has
>echo "test" > file.hasnot
2. Now I do:
> grep --include="file.has" -l test *
file.hasnot
I would expect the command to output "file.has". The behavior shown is
the behavior of "--exclude":
> grep --exclude="file.has" -l test *
file.hasnot
This is not a very practical example and doesn't show the maximal
confusion. So another demonstration:
1. Create a new subdirectory and make an additional copy of the files into the
subdir.
> mkdir sub
> cp file.* sub/
2. Now do the above commands recursively:
> grep -rl --include="file.has" test *
file.hasnot
sub/file.has
> grep -rl --exclude="file.has" test *
file.hasnot
sub/file.hasnot
This is definitely not the expected behavior.
I have built an up-to-date grep (grep 2.7) from the GNU homepage, and
this does not have the problematic behavior, so I guess the best
solution is to upgrade grep.
** Affects: grep (Ubuntu)
Importance: Undecided
Status: New
--
--include does the same as --exclude!
https://bugs.launchpad.net/bugs/651867
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs