How to read only the second last line of a file
tail -n2 myfile.csv | head -n1 | awk ....?
sed 'x;$!d' <infile
That should work for you.
On each line
xchanges buffers (swaps contents of hold space and pattern space) and, if not on the last line, it
deletes the current pattern space (so nothing gets printed). Only on the last line
sed autoprints the pattern space (which contains the previous line, i.e. second to last one)