bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #18421] grep does'nt search pattern from first file of * set


From: Matthew Woehlke
Subject: [bug #18421] grep does'nt search pattern from first file of * set
Date: Thu, 30 Nov 2006 16:31:02 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0

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

Mikko Mallat wrote:
> grep doesn't search pattern from first file of * set
> [snip]
> address@hidden greptest]# echo string1 > file1
> address@hidden greptest]# echo string2 > file2
> address@hidden greptest]# echo string3 > file3
> address@hidden 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'.

> address@hidden greptest]# grep -e "string2" -f *
> file2:string2

This is correct.

> address@hidden greptest]# grep -e "string3" -f *
> file3:string3

So is this...

> address@hidden greptest]# cat file1
> string1
> address@hidden greptest]# grep -e "string1" -f *
> address@hidden greptest]# mv file1 file4
> address@hidden 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.

> address@hidden greptest]#
> address@hidden 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
> address@hidden 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

[Prev in Thread] Current Thread [Next in Thread]