Issue
I need to retrieve last 100 lines of logs from the log file. I tried the sed command
sed -n -e '100,$p' logfilename
Please let me know how can I change this command to specifically retrieve the last 100 lines.
Solution
You can use tail command as follows:
tail -100 <log file> > newLogfile
Now last 100 lines will be present in newLogfile
EDIT:
More recent versions of tail as mentioned by twalberg use command:
tail -n 100 <log file> > newLogfile
Answered By - Steephen Answer Checked By - Marilyn (WPSolving Volunteer)