file-io - 如何在 Julia 中连续读取不断增长的日志文件的新附加行?
问题描述
有shell命令:
tail -n0 -f /path/to/growing/log
连续显示文件新添加的行。
请指导我实现 Julia 的目标!
解决方案
只是反复读取文件:
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
推荐阅读
- css - 分页符在nodejs中的html-pdf转换器中不起作用
- android - Cordova Android 应用程序 - 适用于 Android 7、8、9;在 Android 4,5 和 6 上失败
- machine-learning - 基因表达数据的特征选择
- python - ProgrammingError: (psycopg2.errors.UndefinedColumn),在使用 sqlalchemy 时
- wso2 - 如何运行 WSO2 Streaming Integrator Editor
- swagger - 有没有办法在为 swagger codegen 生成的模型中创建静态字段?
- javascript - 如何刷新页面,Google app Script Web
- sql - 将带有制表符和换行符的列从 Informix 数据库导出到 Excel
- postgresql - PostgresSQL:在 Unnest 上使用 Where 子句和现有连接
- python - Python - 使用 ElementTree 解析带有重复标签的 XML