shell gets the last line of the file

 There are many ways for shell to get the last line of the file. For example, sed/awk can be realized, but if you get a super large file, such as a 100G file, the simple sed and awk commands I use at this time are very slow. At this time, you can use tail to achieve, the specific 3 commands I tested are as follows:

awk 'END {print}' a.log
sed -n '$p' a.log
tail -n 1 a.log

 

 

Guess you like

Origin blog.csdn.net/whatday/article/details/113861372