I have a PHP script which produces a error log. Now I have my script set to append a line on each successful SQL insert.
But after 1,5 million records it gets kinda full. I'd like to have my log a max amount of lines but I don't really know how to read out/remove lines without removing the file.
Let's say my file can have 20 files max, after that it should remove the first line and append another.
Can someone guide me in the correct direction? Or if a script will be posted, please elaborate.
tail,sedand any other Unix tool will have to do the exact same thing, read the whole file and write it back (although it should do it faster, as it is optimised in native code to do it).