linux delete line in log code example
Example 1: linux clear lines of log
$ wc -l myscript.log
475494 myscript.log
$ echo "$(tail -1000 myscript.log)" > myscript.log
$ wc -l myscript.log
1000 myscript.log
Example 2: linux clear lines of log
tail -n 1000 myscript.log | sponge myscript.log