[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Grep 2.6.3 disobeys --include option
From: |
Gerald Britton |
Subject: |
Grep 2.6.3 disobeys --include option |
Date: |
Sun, 23 Jan 2011 17:58:20 -0500 |
If I have these files in my directory:
foo
bar
fum.txt
and I issue this command from this directory:
grep --include=*txt 'foobar'
I do not get the results expected as described by the option:
--include=GLOB
Search only files whose base name matches GLOB (using wildcard
matching as described under --exclude).
Example:
$ls -l
total 12
-rw-r--r-- 1 jerryb jerryb 7 2011-01-23 17:43 bar
-rw-r--r-- 1 jerryb jerryb 7 2011-01-23 17:43 foo
-rw-r--r-- 1 jerryb jerryb 7 2011-01-23 17:43 fum.txt
$ cat *
foobar
foobar
foobar
Grep without --include option:
$ grep 'foobar' *
bar:foobar
foo:foobar
fum.txt:foobar
Grep with --include option:
$ grep --include=*txt 'foobar' *
bar:foobar
foo:foobar
As you can see, --include was treated like --exclude, which,
incidentally, gives the same results:
$ grep --exclude=*txt 'foobar' *
bar:foobar
foo:foobar
Grep version:
$ grep --version
GNU grep 2.6.3
Environment:
$ uname -a
Linux TheBrittons 2.6.35-24-generic #42-Ubuntu SMP Thu Dec 2 02:41:37
UTC 2010 x86_64 GNU/Linux
--
Gerald Britton
- Grep 2.6.3 disobeys --include option,
Gerald Britton <=