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

  • It seems that someone has a lab for computer science. They don’t like this, but I’m also interested in how to solve a similar problem. - don Rumata
  • To get names where there are duplicate parts on Python: for parts in product(digits, repeat=3): if len(set(parts)) < len(parts) or '1' in parts: print(Path(*parts) / '1.txt') - jfs
  • Read man awk - imsysmem
  • Something like find /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 find /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 find /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 in man grep ). - 0andriy Nov. 27

0