I have a log file that gets big fast. I tried using tail
with this syntax but it didn't work.
tail logfile.log -n 100000 > logfile.log
The output file is 0 bytes and blank. What am I doing wrong? Will I need to use an intermediary file?
I have a log file that gets big fast. I tried using tail
with this syntax but it didn't work.
tail logfile.log -n 100000 > logfile.log
The output file is 0 bytes and blank. What am I doing wrong? Will I need to use an intermediary file?
You could use something like this, but it's not really recommended:
{ rm logfile.log && tail -n 100000 > logfile.log ;} < logfile.log
This is better:
tail -n 100000 logfile.log > _tmp_ &&
mv -- _tmp_ logfile.log