在从tail -f到grep的管道输出后写入文件 [英] write to a file after piping output from tail -f through to grep

查看:1544
本文介绍了在从tail -f到grep的管道输出后写入文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找从tail -f到grep的管道输出后写入文件。
说,在error_logFreeSwitch.log中写入所有具有正在播放:的行的文件temp。

  tail -f/var/lof/freeswitch/freeswitch.log| grep播放:> temp 

但不工作!这是一个5.5分钟的解决方案。

也许你有一个缓冲问题?请参阅 BashFAQ:什么是缓冲



你可以例如尝试:

  tail -f /var/lof/freeswitch/freeswitch.log | grep --line-buffered播放:> temp 


I'm looking to write to a file after piping output from tail -f through to grep. Say,write to a file "temp" for all lines with "Playing:" within in error_log "FreeSwitch.log".

 tail -f "/var/lof/freeswitch/freeswitch.log" | grep "Playing:" > temp

but not working ! It is a centos 5.5

解决方案

Maybe you have an issue with buffering? See BashFAQ: What is buffering?

You could e.g. try:

tail -f /var/lof/freeswitch/freeswitch.log | grep --line-buffered "Playing:" > temp

这篇关于在从tail -f到grep的管道输出后写入文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆