I'm trying to find/extract directories based on an expression that applies to the file path. For example, I used the command:
find . -type d -links 2
To get a list of directories that looks something like this:
./foo/ABC/W
./foo/ABC/X
./foo/ABC/Y
./foo/ABC/Z
./foo/BCD/W
./foo/BCD/X
./foo/BCD/Y
./foo/BCD/Z
./foo/CDE/W
./foo/CDE/X
./foo/CDE/Y
./foo/CDE/Z
./bar/CDE/V
./bar/CDE/Q
./bar/BCD/V
./bar/BCD/Q
./bar/ABC/V
./bar/ABC/Q
I'm wondering how to take this list, and extract only filepaths containing say, "CDE" in them:
./foo/CDE/W
./foo/CDE/X
./foo/CDE/Y
./foo/CDE/Z
./bar/CDE/V
./bar/CDE/Q
This is what I've tried so far, which outputs nothing when I try it:
find . -type d -links 2 -name "CDE" -print