I created a bunch of folders like: "0/0/0" "0/0/1", etc. "9/9/9" (three levels each with 10 subdirectories from 0 to 9) in each folder created a file with name 1.txt. Tell me how to find the files in the full name of which have the same numbers (for example, 3/5/3 / 1.txt or 1/3/9 / 1.txt) and display these names on the screen
for parts in product(digits, repeat=3): if len(set(parts)) < len(parts) or '1' in parts: print(Path(*parts) / '1.txt')- jfsman awk- imsysmemfind /path/to/begin/with -name "1.txt" | while read f; do x=${f%\.txt}; if echo $x | tr '/' '\n'| sort | uniq -c | grep -q '^[[:space:]]\+2 '; then echo $f; fi; donefind /path/to/begin/with -name "1.txt" | while read f; do x=${f%\.txt}; if echo $x | tr '/' '\n'| sort | uniq -c | grep -q '^[[:space:]]\+2 '; then echo $f; fi; donefind /path/to/begin/with -name "1.txt" | while read f; do x=${f%\.txt}; if echo $x | tr '/' '\n'| sort | uniq -c | grep -q '^[[:space:]]\+2 '; then echo $f; fi; done. I wrote quickly and on my knee, I am sure, it can be simplified. If you use regular expressions with labels, then just find + sed will do everything. Well, there it’s not necessary to check for 2 , but not for 1 (more details inman grep). - 0andriy Nov. 27