bug-grep
[Top][All Lists]
Advanced

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

bug#43782: in egrep (grep 3.0), the order of include & exclude is surpri


From: John Ruckstuhl
Subject: bug#43782: in egrep (grep 3.0), the order of include & exclude is surprisingly significant
Date: Mon, 5 Oct 2020 15:57:32 +0000

> This
>     $ egrep -r -i -n -l --exclude="*.bak" --include="*.py" "$PAT" "$DIR"
> does not map to this
>     find "$DIR" -type f ! -name "*.bak" -name "*.py" |
>     while read F; do egrep -i -n -l "$PAT" "$F"; done
>
> It maps to this (with INCFIRST representing "-true" or "-false")
>      find "$DIR" -type f \( \
>          \( ! -name "*.bak" ! -name "*.py" \) \( \
>              ! "$INCFIRST" \( -true \) \
>              -o \
>              "$INCFIRST" \( ! -name "*.bak" -name "*.py" \) \
>          \) \
>          -o \
>              \( ! -name "*.bak" -name "*.py" \) \
>      \) |
>     while read F; do egrep -i -n -l "$PAT" "$F"; done
>
> Yikes.
> As it is not yet documented,
> I'll happily venmo you $50 to consider it a bug instead of an undocumented 
> behavior.
> Warm regards, Paul.  :)
> John Ruckstuhl

okay, the above mess simplifies of course to something less yikesy,
    find "$DIR" -type f \( \
        \( ! -name "*.bak" -name "*.py" \) \
        -o ! "$INCFIRST" \( ! -name "*.bak" ! -name "*.py" \) \
    \) |
    while read F; do egrep -i -n -l "$PAT" "$F"; done

but the $50 offer still stands... :)

reply via email to

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