I am using
tail -f (in Terminal on Mac OS X el capitan) to view the live changes to my file (the results of pulling data from a database using a PERL script). However, sometimes, the Perl script will truncate the file and add new data to it. Sometimes, when this happens, it gives me this message:
tail: test.txt: file truncated
And then does not show any contents of the file afterwards. This seems to only happen when I'm replacing a file with LESS rows than before. When the new rows are longer than before running the script, I do not get this error and the
tail -f continues to work. I have confirmed that there are, in fact, data in the file that
tail -f is not showing after getting this (error?) message.
I've seen this similar question: Suppress 'file truncated' messages when using tail
tail -f test.txt 2> /dev/null
But that just suppresses the message and still breaks, it doesn't continue to show me the shorter, truncated file contents.
Is there a better command to use to live view changes to the file? Or a flag for
tail -f to not care when the file is truncated?