wikiti
6/19/2017 - 8:35 AM

Keep N lines of file

Keep N lines of file

# Usage
echo "$(tail -[N] [file])" > [file]

# Example
# NOTE: This may use too much memory. 
echo "$(tail -500000 shared/log/production.log)" > shared/log/production.log

# Please note that `echo` must be used since tail starts redirecting before
# it finishes outputing the lines of the file.