Keep last number of lines in a file
Here is a quick way to keep the last 5000 lines of a large file instead of entirely clearing it. A little bit of AWK though a simple array and bob's your uncle: root [XYZ01] /var/spool/mail: ls -altri test.txt daemon 1067 -rw-rw—- 1 daemon mail 51130586 Jan 31 07:30 daemon 1061 -rw-rw—- 1 daemon mail […]