I have files named memOutput.X
where X
ranges from 0 to 47 in a directory. I want to see the line with the last occurrence of VmData
in all these files. I can run
grep VmData memOutput.0 | tail -1
to get the last match from one file but not sure how to do it for a range of files. Also, grep VmData memOutput.* | tail -1
displayed only the last match from file memOutput.47
. Is there an alternative to grep
?
Thanks.