Issue
I have a file that has the following as the last three lines. I want to retrieve the penultimate line, i.e. 100.000;8438; 06:46:12
.
.
.
.
99.900; 8423; 06:44:41
100.000;8438; 06:46:12
Number of patterns: 8438
I don't know the line number. How can I retrieve it using a shell script? Thanks in advance for your help.
Solution
Try this:
tail -2 yourfile | head -1
Answered By - MattH Answer Checked By - Candace Johnson (WPSolving Volunteer)