I need to look for the string "Total CPU time used" in a set of files that are generated in an iterative calculation within a great number of subfolders called
folder_C and so on.
folder_A i would have
next to some other files with different names. In
folder_B there would be
and so on, so every subfolder would contain a different amount of iterative steps and thus a different number appending the last file. I think the way to go is using recursive
grep sorting out the alphabetically last file, the code I've tried is:
grep -r "Total CPU time used" */file_* | tail -1
However this only gives me an output of the last file in the last directory
folder_Z. How do I grep the string from all subdirectories so that
folder_B/file_3_1 and so on are not skipped?