• syntax of "find" - am I losing my mind?

    From Kenny McCormack@21:1/5 to All on Fri Dec 27 20:08:53 2024
    I'm trying to find all files in my home dir that are not in group foo or
    group bar. Most of my files are in one or the other of these groups.

    This is my tcsh command line:

    % find ~ -xdev \! \( -group foo -o -group bar \) -ls

    This dumps out every file. It should just dump out a few. Why?

    I tried replacing \! with -not and I tried replacing -o with -or.
    Neither helped.

    I'm sure I've done this sort of thing in the past (successfully).
    --
    "I think I understand delicate, but why do I have to wash my hands, and
    be standing in cold water when doing it?"

    Kaz Kylheku <[email protected]> in comp.lang.c

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to Kenny McCormack on Fri Dec 27 21:57:52 2024
    On 2024-12-27, Kenny McCormack <[email protected]> wrote:
    I'm trying to find all files in my home dir that are not in group foo or group bar. Most of my files are in one or the other of these groups.

    This is my tcsh command line:

    % find ~ -xdev \! \( -group foo -o -group bar \) -ls

    It works for me. For instance if I run this on /etc using

    -group root -o group shadow

    I get only entries that are in groups lp or dip. If I switch
    to dip, I get entries in lp and shadow.

    Yes, I also tried it in tcsh just to be sure, and I tried it in
    my home directory.

    This dumps out every file. It should just dump out a few. Why?

    Maybe some invisible junk characters in the command line?
    Try typing it out afresh.

    Is there direct proof in the output that the results are wrong? Are any
    of the listed files in group foo or bar contrary to the query?

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @[email protected]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From marrgol@21:1/5 to All on Fri Dec 27 22:39:14 2024
    On 2024-12-27 at 21:08 Kenny McCormack wrote:
    I'm trying to find all files in my home dir that are not in group foo or group bar. Most of my files are in one or the other of these groups.

    This is my tcsh command line:

    % find ~ -xdev \! \( -group foo -o -group bar \) -ls

    This dumps out every file. It should just dump out a few. Why?

    I tried replacing \! with -not and I tried replacing -o with -or.
    Neither helped.

    I'm sure I've done this sort of thing in the past (successfully).

    $ find ~ -xdev -not -group foo -not -group bar -ls

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From marrgol@21:1/5 to All on Fri Dec 27 22:59:30 2024
    On 2024-12-27 at 22:39 marrgol wrote:
    On 2024-12-27 at 21:08 Kenny McCormack wrote:
    I'm trying to find all files in my home dir that are not in group foo or
    group bar. Most of my files are in one or the other of these groups.

    This is my tcsh command line:

    % find ~ -xdev \! \( -group foo -o -group bar \) -ls

    This dumps out every file. It should just dump out a few. Why?

    I tried replacing \! with -not and I tried replacing -o with -or.
    Neither helped.

    I'm sure I've done this sort of thing in the past (successfully).

    $ find ~ -xdev -not -group foo -not -group bar -ls

    I've just tried your version too and both give the the same and correct
    result -- are you sure you are using GNU findutils find? Mine is v4.8.0.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Wayne@21:1/5 to Kenny McCormack on Fri Dec 27 16:29:25 2024
    The "-ls" doesn't work as yoiu expect. Try something like -print or
    -printf instead.

    --
    Wayne

    On 12/27/2024 3:08 PM, Kenny McCormack wrote:
    I'm trying to find all files in my home dir that are not in group foo or group bar. Most of my files are in one or the other of these groups.

    This is my tcsh command line:

    % find ~ -xdev \! \( -group foo -o -group bar \) -ls

    This dumps out every file. It should just dump out a few. Why?

    I tried replacing \! with -not and I tried replacing -o with -or.
    Neither helped.

    I'm sure I've done this sort of thing in the past (successfully).

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Christian Weisgerber@21:1/5 to Kenny McCormack on Fri Dec 27 22:37:26 2024
    On 2024-12-27, Kenny McCormack <[email protected]> wrote:

    I'm trying to find all files in my home dir that are not in group foo or group bar. Most of my files are in one or the other of these groups.

    This is my tcsh command line:

    % find ~ -xdev \! \( -group foo -o -group bar \) -ls

    Works for me. You can also de-morgan the expression

    % find ~ -xdev \! -group foo \! -group bar -ls

    but obviously that won't change whatever underlying problem you're
    having.

    --
    Christian "naddy" Weisgerber [email protected]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kenny McCormack@21:1/5 to [email protected] on Sat Dec 28 01:16:54 2024
    In article <[email protected]>,
    Christian Weisgerber <[email protected]> wrote:
    On 2024-12-27, Kenny McCormack <[email protected]> wrote:

    I'm trying to find all files in my home dir that are not in group foo or
    group bar. Most of my files are in one or the other of these groups.

    This is my tcsh command line:

    % find ~ -xdev \! \( -group foo -o -group bar \) -ls

    Works for me.

    OK - I've got this sorted now.

    tl; dr: It works if you put in the correct numeric gid(s) rather than the symbolic group names. So, I am not losing my mind, and the syntax is
    correct.

    Longer version: The system on which I am running this (not my system) is a little bit misconfigured, such that even though both ls and find display
    the group id of my files as "foo", and "foo" is defined in /etc/group as
    having gid (say) 1234, in fact, my files are not in group 1234, but rather
    in group (say) 5678.

    So, bottom line, when you use the name "foo" in the command line, "find" translates that to 1234 and looks for files not in group 1234 (which is
    almost all of them) and so on...

    --
    I'll give him credit for one thing: He is (& will be) the most quotable President
    ever. Books have been written about (GW) Bushisms, but Dubya's got nothing on Trump.

    Tremendously wet - from the standpoint of water.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Christian Weisgerber on Sat Dec 28 02:04:51 2024
    On Fri, 27 Dec 2024 22:37:26 -0000 (UTC), Christian Weisgerber wrote:

    You can also de-morgan the expression

    First time I heard a reference to De Morgan’s theorems being used as a
    verb. ;)

    Does make it sound like you are removing something called “morgan” though, doesn’t it ...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kenny McCormack@21:1/5 to [email protected] on Sat Dec 28 10:20:11 2024
    In article <vknmc3$3v5eh$[email protected]>,
    Lawrence D'Oliveiro <[email protected]d> wrote:
    On Fri, 27 Dec 2024 22:37:26 -0000 (UTC), Christian Weisgerber wrote:

    You can also de-morgan the expression

    First time I heard a reference to De Morgans theorems being used as a
    verb. ;)

    Does make it sound like you are removing something called morgan though, >doesnt it ...

    I think the word we're looking for here is: un-de-morgan.

    That is, to translate the verbose but more understandable:

    !foo and !bar

    into:

    ! (foo or bar)

    via application of De Morgan's law(s) would be to de-morgan it.

    CW was suggesting the reverse operation.

    --
    People sleep peaceably in their beds at night only because rough
    men stand ready to do violence on their behalf.

    George Orwell

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Salvador Mirzo@21:1/5 to Kenny McCormack on Sat Dec 28 14:35:15 2024
    [email protected] (Kenny McCormack) writes:

    In article <vknmc3$3v5eh$[email protected]>,
    Lawrence D'Oliveiro <[email protected]d> wrote:
    On Fri, 27 Dec 2024 22:37:26 -0000 (UTC), Christian Weisgerber wrote:

    You can also de-morgan the expression

    First time I heard a reference to De Morgans theorems being used as a
    verb. ;)

    Does make it sound like you are removing something called morgan though, >>doesnt it ...

    I think the word we're looking for here is: un-de-morgan.

    That is, to translate the verbose but more understandable:

    !foo and !bar

    into:

    ! (foo or bar)

    via application of De Morgan's law(s) would be to de-morgan it.

    CW was suggesting the reverse operation.

    I'd suggest that to write

    !(foo or bar)

    is /to de-morgan/ the expression ``!foo and !bar'', while to rewrite
    back as !(foo or bar) is /to morgan/ the expression.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Salvador Mirzo on Sat Dec 28 19:12:08 2024
    On 28.12.2024 18:35, Salvador Mirzo wrote:
    [email protected] (Kenny McCormack) writes:

    In article <vknmc3$3v5eh$[email protected]>,
    Lawrence D'Oliveiro <[email protected]d> wrote:
    On Fri, 27 Dec 2024 22:37:26 -0000 (UTC), Christian Weisgerber wrote:

    You can also de-morgan the expression

    First time I heard a reference to De Morgans theorems being used as a
    verb. ;)

    Does make it sound like you are removing something called morgan though, >>> doesnt it ...

    I think the word we're looking for here is: un-de-morgan.

    That is, to translate the verbose but more understandable:

    !foo and !bar

    into:

    ! (foo or bar)

    via application of De Morgan's law(s) would be to de-morgan it.

    CW was suggesting the reverse operation.

    I'd suggest that to write

    !(foo or bar)

    is /to de-morgan/ the expression ``!foo and !bar'', while to rewrite
    back as !(foo or bar) is /to morgan/ the expression.

    I've ever always seen both directions as transformations according
    to the laws of De Morgan (so neither would be en-morgan or de-morgan,
    sort of).

    In context of 'find' the '-and' form might be considered simpler due
    to 'find's inherent 'and'-logic.

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Salvador Mirzo@21:1/5 to Janis Papanagnou on Mon Dec 30 18:15:46 2024
    Janis Papanagnou <[email protected]> writes:

    On 28.12.2024 18:35, Salvador Mirzo wrote:
    [email protected] (Kenny McCormack) writes:

    In article <vknmc3$3v5eh$[email protected]>,
    Lawrence D'Oliveiro <[email protected]d> wrote:
    On Fri, 27 Dec 2024 22:37:26 -0000 (UTC), Christian Weisgerber wrote:

    You can also de-morgan the expression

    First time I heard a reference to De Morgans theorems being used as a
    verb. ;)

    Does make it sound like you are removing something called morgan though, >>>> doesnt it ...

    I think the word we're looking for here is: un-de-morgan.

    That is, to translate the verbose but more understandable:

    !foo and !bar

    into:

    ! (foo or bar)

    via application of De Morgan's law(s) would be to de-morgan it.

    CW was suggesting the reverse operation.

    I'd suggest that to write

    !(foo or bar)

    is /to de-morgan/ the expression ``!foo and !bar'', while to rewrite
    back as !(foo or bar) is /to morgan/ the expression.

    I've ever always seen both directions as transformations according
    to the laws of De Morgan (so neither would be en-morgan or de-morgan,
    sort of).

    We're defining directions here so that we can speak and look cool. We
    can all pose as intellectuals. And people will have to look up the
    morgan verb---unsuccessfully.

    In context of 'find' the '-and' form might be considered simpler due
    to 'find's inherent 'and'-logic.

    I think en-morgan should making something jump into the parentheses and de-morgan should be the reverse. We should not be too logical. We
    should prioritize how we sound and how our powerpoint presentations will
    look like when we're presenting our style.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lew Pitcher@21:1/5 to Salvador Mirzo on Tue Dec 31 15:54:20 2024
    On Mon, 30 Dec 2024 18:15:46 -0300, Salvador Mirzo wrote:

    [snip]

    I think en-morgan should making something jump into the parentheses and de-morgan should be the reverse.

    As those specific laws of valid inference were named after Augustus De Morgan (son of John De Morgan and Elizabeth Dodson), with "De Morgan" being Agustus' surname, it is fitting to refer to them as "De Morgan's laws" or "De Morgan's theorem"

    I propose that the verb "DeMorgan" (as in "to DeMorgan an expression") be
    used to represent the application of the normal form of "De Morgan's theorem", and the verb "deDeMorgan" be used to represent the application of the inverse of "DeMorgan".


    Just my 10(binary) cents worth, of course :-)
    --
    Lew Pitcher
    "In Skills We Trust"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Grant Taylor@21:1/5 to Lew Pitcher on Tue Dec 31 16:32:21 2024
    On 12/31/24 09:54, Lew Pitcher wrote:
    I propose that the verb "DeMorgan" (as in "to DeMorgan an expression")
    be used to represent the application of the normal form of "De
    Morgan's theorem", and the verb "deDeMorgan" be used to represent
    the application of the inverse of "DeMorgan".

    I would suggest "un-DeMorgan" (hyphen optional) in order to avoid
    conflict between the two pairs of "de" (case insensitive).



    --
    Grant. . . .

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Salvador Mirzo@21:1/5 to Grant Taylor on Tue Dec 31 23:28:31 2024
    Grant Taylor <[email protected]> writes:

    On 12/31/24 09:54, Lew Pitcher wrote:
    I propose that the verb "DeMorgan" (as in "to DeMorgan an
    expression") be used to represent the application of the normal form
    of "De Morgan's theorem", and the verb "deDeMorgan" be used to
    represent the application of the inverse of "DeMorgan".

    I would suggest "un-DeMorgan" (hyphen optional) in order to avoid
    conflict between the two pairs of "de" (case insensitive).

    Well said---the world has enough conflicts; not to mention all the IRQ conflicts I went through when running Windows 3.11 back in 19... I
    forget.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)