Reverse search a Text file from last line to top line
I would like to search a text file and start outputting the contents of the txt file from the last line to the first line. For example;
I want it to be outputted as;
What I want to accomplish out of this is for a user to search a word and output say the last 4 lines that contain that word from the most recent log entry (I am recording the activity of a chatroom and so I want the most recent of the chatrooms messages.) Unless there is a way of stacking the messages in a chatroom from a user, so the most recent messages are at the top of the text file.
EDIT: Also please do not complain that I haven't looked on the internet, I have, all my google searches are filled with purple links, none of them really useful, this code in my opinion should be simple, well hopefully it is.