samedi 4 juillet 2015

Does unix utility tail read through the whole file?

I used tail utility with option -f to watch one of my log files. My CGI program always sent only the last 40 lines of the log file to my webpage, where I can monitor the log real time and with audible notifications. Now I would like to send only the last 40 lines which meet some conditions, eg. matches to any pattern. I think I have to use grep, but how can I select only the last 40 matching lines? Do I have to use "tail" twice?

Aucun commentaire:

Enregistrer un commentaire