Skip to main content
edited tags
Link
Gilles 'SO- stop being evil'
  • 865.9k
  • 205
  • 1.8k
  • 2.3k
Source Link

List of subdirectories that contains a particular file name

I am wondering if i can do this in a single shell command.

I am in home directory and want to find a list of subdirectories that contains a particular file. The file name and the depth is always same. For example if something like this,

/karthik/A/B/C/1/D/E.txt /karthik/A/B/C/2/D/E.txt /karthik/A/B/C/3/D/E.txt /karthik/A/B/C/4/D/E.txt /karthik/A/B/C/5/D/E.txt 

I want to print 1 2 3 4 5

Can we do it in a single shell command and if so, how?