如何将函数应用于 tail -f 的输出?
How to apply a function to the output of tail -f?
我有一个不断更新的日志文件。我可以使用 tail -f
查看文件并查看所有更改。但是,有一个问题 - 文本包含字符 \n 而不是换行符。我想将字符 \n 更改为实际的换行符。我该怎么做?
找到适合我的解决方案:
tail -f logfile | sed 's/\n/\
/g'
我有一个不断更新的日志文件。我可以使用 tail -f
查看文件并查看所有更改。但是,有一个问题 - 文本包含字符 \n 而不是换行符。我想将字符 \n 更改为实际的换行符。我该怎么做?
找到适合我的解决方案:
tail -f logfile | sed 's/\n/\
/g'