I have a directory of files like so:
parent
/dir1
file1
file2
other
something
name_pattern.o23409284
name_pattern.o29203429
name_pattern.o39208235
/dir2
...
I want to run a command that will look in the newest name_pattern.o* file for a line beginning with:
***END
So it seems easy enough to do
grep -c '***END' name_pattern.o*
but I want to only look at the most recent file and ignore all others. So I think I need some kind of find
command that will choose the newest file. I just don't know how to do that.