Skip to main content
1 of 4

Find file and get only directory path

I am attempting to find files and then grep expression for some string in the files, then only get back the full directory path the files are found in.

find `pwd` -iname '*.py' -type f -exec bash -c "grep -l 'nn'; sed 's[\/](.*)*[\/]/d' {}" \; 

However, the sed expression will have the terminal hang, rather than recursively print out the files and removing the file from the directory path.