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.
I can partially achieve this with:
find `pwd` -iname 'nn*' -type d
However, this expects the directory name to have nn
and not for nn
inside the file.