I have a file that updates itself by appending, however this file becomes huge (500MB). I would like to read the last 50 lines in the file. How can this be done?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Tail -n50 will return the last 50 lines of the file.
Therefore, you don’t have to load the entire file in memory.
Edit:
If you want to echo “
<br>” after each line you do: