I am looking for a way to periodically remove the first N lines of a file, to implement a "quick and dirty" log file size management scheme.
-- I have found that vi will effectively do this, and (somewhat surprisingly) the logging application seems to be okay with its log file being modified.
I have a vim script (del25.keys) with this command: d25dZZ (delete 25 lines and write/quit).
I run vi like this: vi -n -s del25.keys FILE
The problem I'm running into is that in the corner case that FILE is modified by the logging application at the same instant that vi is doing its processing, vi issues W11 on save (file externally modified). I'm not too concerned about losing one or two log lines occasionally, so I want it to "auto yes" (suppress the warning) to avoid stopping my script.
I've tried a few different mechanisms to address this, including slightly different commands and FileChangedShell, but the warning remains. Is there a way to actually suppress this warning so my script will run without "getting stuck in this corner case? Thanks for your thoughts.
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/49d8019d-249d-488c-b948-f08d6df96959%40googlegroups.com.
No comments:
Post a Comment