I have an issue running through log files.
I'm looking to use ls
to create a list of files in the log directory and grep
to run through for the specific instances/times the file ran. I only want to have the last line of each file so I want the tail -1
command to run off the list of files grep
provided.
I've tried multiple combinations of code that I've run across but have not had any luck so far; at this point it has become more of a curiosity than useful due to the amount of time I've spent on this. Below are a couple examples of the instances I have attempted:
ls | grep 2011_.._.._.._35_.* | tee >(tail -1)
ls | tee >(grep 2011_.._.._.._35_.*) | tail -1
Additionally, I would like to do this with a single command line if possible rather than creating a script and running a loop.