如何在 julia 中连续读取不断增长的日志文件的新附加行?
How to read the newly appended lines of a growing log file continuously in julia?
有shell命令:
tail -n0 -f /path/to/growing/log
连续显示文件中新添加的行。
请指导我在 Julia 中实现 objective!
只是反复阅读文件:
file = open("/path/to/growing/log")
seekend(file) # ignore contents that are already there to match the `-n0` option
while true
sleep(0.2)
data = read(file, String)
!isempty(data) && print(data)
end
有shell命令:
tail -n0 -f /path/to/growing/log
连续显示文件中新添加的行。
请指导我在 Julia 中实现 objective!
只是反复阅读文件:
file = open("/path/to/growing/log")
seekend(file) # ignore contents that are already there to match the `-n0` option
while true
sleep(0.2)
data = read(file, String)
!isempty(data) && print(data)
end