I have multiple subdirectories at multiple levels containing a file results.out./dir1/results.out./dir2/dir21/results.out./dir3/dir31/dir311/results.outNow I need to search for string1 in results.out and extract the directory path of those results.out that contain the string1, since I need to move these sub-directories to another location. For example, I can get the file path using the following codefor i in $(find . -type f -name results.out);dogrep -l string1 $idoneHow to modify the above code to get only the directory path?
Extract the directory path containing the file with matching string
files;grep;find;directory