On Saturday 24 July 2010 02:18 AM, steve wrote:
find /path/to/dir -user user1 -o -group user2 -not -user user3
this above command with find all files owner by user1 or group owned by user2 but not owned by user3. Because ...
I tried the combination of 2 expressions with ' or' and their combination with a third 'and' for my specific requirement but I did not get the desired search result. Every combination I could think of was tried....first this then that etc. Then on the net I found a delimiter and brackets combination similar to my needs and that query gave accurate results.
find /path -expr1 /( -expr2 -o expr3 /) -exec {}..........
expr1's query is 'anded' with the result of the 'oring' of expr2 and expr3. logically it is 'expr1 and (expr2 or expr3)'.
This delimiter or escape sign '' is a funny thing. In file names with spaces as well as commands, it makes the line continue further but in the find command it is called the escape or delimiter.