GNU bug report logs - #63962
possible error in the grep program

Previous Next

Package: grep;

Reported by: Василий Алексеенко <vasilisc777 <at> gmail.com>

Date: Thu, 8 Jun 2023 15:29:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


Message #10 received at 63962-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Василий Алексеенко
 <vasilisc777 <at> gmail.com>
Cc: 63962-done <at> debbugs.gnu.org
Subject: Re: bug#63962: possible error in the grep program
Date: Thu, 8 Jun 2023 14:07:16 -0700
On 6/8/23 04:27, Василий Алексеенко wrote:

> 1) The initial list of IP addresses in the file is formed start_list.txt .
> 
> 2) Must be removed from the list start_list.txt IP addresses using a
> larger file exclude_list.txt
> 
> grep -vF --file=exclude_list.txt start_list.txt > list_grep.txt

The line '10.0.23.4' in exclude_list.txt matches the line '10.0.23.48' 
in start_list.text. That is, the first line is a substring of the second 
line. So this usage of 'grep' doesn't do what you want.

To get the effect you want, also use the -x option. E.g.:

grep -vxF -f exclude_list.txt start_list.txt




This bug report was last modified 1 year and 349 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.