I have moved a file, which makes a reference to four other files with the same parent directory. And now I am stock trying to figure out which parent directory that is since there a number of files with the same name in my build environment. But I don't want to take any chances and copy the wrong file. So I want to know if there a way to tell Linux find command or some other command to give me the results matching two or more strings. So I only want to see matches for locations which contain files:
foo & bar & buz
I can always pipe this into grep for the desired common directory, but if there is an easier way then I would love it. Something like:
common_direcoty/foo & common_directory/bar & common_directory/buz
In other words, I am looking for the copy of these files with a common directory. I am not looking for the file that matches the name alone.
Here is the output of the command which gave me what I was after:
sansari@ubuntu:~/WORKING_DIRECTORY$ find . -name io.h -exec sh -c '[ -e "${0%/*}/kernel.h" ] && [ -e "${0%/*}/init.h" ]' {} \; -print
./include/linux/io.h
sansari@ubuntu:~/WORKING_DIRECTORY/include/linux$ ls module.h
module.h
sansari@ubuntu:~/WORKING_DIRECTORY/include/linux$ ls kernel.h
kernel.h
sansari@ubuntu:~/WORKING_DIRECTORY/include/linux$ ls init.h
init.h
sansari@ubuntu:~/WORKING_DIRECTORY/include/linux$ ls io.h
io.h