小编Ced*_*ric的帖子

tail -f,日志空闲3秒后插入换行符?

执行 a 时tail -f error.log,如何在 3 秒内未向文件附加任何内容后以编程方式插入换行符?

(显然,一旦添加了一个换行符,在将另一行文本添加到日志文件之前,不应添加其他换行符)

例如,这些行被附加到 error.log :

foo
bar
boo [[wait 4 seconds]]
2far
2foo
2bar
2boo [[wait 40 seconds]]
2far
Run Code Online (Sandbox Code Playgroud)

这将是控制台中的输出:

foo
bar
boo

2far
2foo
2bar
2boo

2far
Run Code Online (Sandbox Code Playgroud)

shell-script tail text-processing

15
推荐指数
3
解决办法
1922
查看次数

标签 统计

shell-script ×1

tail ×1

text-processing ×1