Follow-up Comment #1, bug #18421 (project grep):

Mikko Mallat wrote:
> grep doesn't search pattern from first file of * set
> [snip]
> [EMAIL PROTECTED] greptest]# echo string1 > file1
> [EMAIL PROTECTED] greptest]# echo string2 > file2
> [EMAIL PROTECTED] greptest]# echo string3 > file3
> [EMAIL PROTECTED] greptest]# grep -e "string1" -f *

This is the expected result. You instructed grep to look for "string1" or the
contents of 'file1' ("string1") in the files 'file2' and 'file3'. No result is
the correct behavior. Re-read the man page, particularly '-f'.

> [EMAIL PROTECTED] greptest]# grep -e "string2" -f *
> file2:string2

This is correct.

> [EMAIL PROTECTED] greptest]# grep -e "string3" -f *
> file3:string3

So is this...

> [EMAIL PROTECTED] greptest]# cat file1
> string1
> [EMAIL PROTECTED] greptest]# grep -e "string1" -f *
> [EMAIL PROTECTED] greptest]# mv file1 file4
> [EMAIL PROTECTED] greptest]# grep -e "string1" -f *
> file4:string1

...and this. Now you asked grep to find "string1" and the contents of 'file2'
("string2") in 'file3' and 'file4'. Since 'file4' contains "string1", it
matched the -e expression.

> [EMAIL PROTECTED] greptest]#
> [EMAIL PROTECTED] greptest]# ls -l
> total 12
> -rw-r--r--    1 root     root            8 Nov 30 13:54 file2
> -rw-r--r--    1 root     root            8 Nov 30 13:54 file3
> -rw-r--r--    1 root     root            8 Nov 30 13:54 file4
> [EMAIL PROTECTED] greptest]# grep -e "string2" -f *

And, as above, this is correct as well.

PEBKAC.


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?18421>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/



Reply via email to