Subject: bug#23965: egrep should report line number when failing to parse a file (with -f)

From: Jim Meyering <[email-masked]>
Date: Wed, 20 Jul 2016 14:58:41 -0700

On Wed, Jul 13, 2016 at 1:59 AM, Santiago Ruano Rincón
<[email-masked]> wrote:
> Please find below yet another old-standing bug filed against debian.
> grep's behaviour is still the same in 2.25.
>
> https://bugs.debian.org/525214
>
> Cheers,
>
> Santiago
>
> ----- Forwarded message from Gunnar Wolf <[email-masked]> -----
>
> Date: Wed, 22 Apr 2009 18:06:28 -0500
> From: Gunnar Wolf <[email-masked]>
> To: Debian Bug Tracking System <[email-masked]>
> Subject: egrep should report line number when failing to parse a file (with -f)
> X-Mailer: reportbug 4.1
>
> [...]
>
> egrep -f takes its input from a file. This functionality is often used
> i.e. with logcheck, which works basically off a directory full of
> files which contain regexes representing log messages to be either
> ignored or pushed up - However, when something goes bad and one of
> those lines is not parsable, grep won't help in debugging. As an
> example, I got loads of log messages such as:
>
>     From: Cron Daemon <[email-masked]>
>     To: [email-masked]
>     Date: Tue, 21 Apr 2009 23:02:02 -0500 (CDT)
>     Subject: Cron <logcheck@lafa>    if [ -x /usr/sbin/logcheck ]; then nice -n10 /usr/sbin/logcheck; fi
>
>     egrep: Unmatched [ or [^
>
> Finding the file/line where I made this particular mistake was a
> tedious job. Users deserve egrep to report the filename and line
> number where this error happened.
>
> [...]

Thank you for forwarding that.
I've written a patch to address that. Will post it shortly.