Linux 屏幕中的Grep未将输出保存到日志文件
我正试图通过我的文件执行很长的grep扫描。因为执行后屏幕将关闭,所以我试图写入日志文件以保存grep的输出。出现以下命令:Linux 屏幕中的Grep未将输出保存到日志文件,linux,bash,grep,gnu-screen,Linux,Bash,Grep,Gnu Screen,我正试图通过我的文件执行很长的grep扫描。因为执行后屏幕将关闭,所以我试图写入日志文件以保存grep的输出。出现以下命令: screen fgrep "needle" /mnt/Volume_volume/haystack/* >> /mnt/Volume_volume/log.txt 不幸的是,日志文件是空的。出了什么问题?屏幕的输出是否被保存而不是grep?如何修复此问题?您编写的命令的意思是:运行屏幕fgrep needle/mnt/Volume\u Volume/hay
screen fgrep "needle" /mnt/Volume_volume/haystack/* >> /mnt/Volume_volume/log.txt
不幸的是,日志文件是空的。出了什么问题?屏幕的输出是否被保存而不是grep?如何修复此问题?您编写的命令的意思是:运行屏幕fgrep needle/mnt/Volume\u Volume/haystack/*并将此命令的结果附加到文件/mnt/Volume\u Volume/log.txt。屏幕在其输出上显示注释,这就是您在日志文件中得到的内容 如果您确实想使用screen,正确的命令如下:
screen bash -c 'fgrep "needle" /mnt/Volume_volume/haystack/* >> /mnt/Volume_volume/log.txt'
但我怀疑很简单:
nohup fgrep "needle" /mnt/Volume_volume/haystack/* >> /mnt/Volume_volume/log.txt &
您编写的命令的意思是:运行屏幕fgrep needle/mnt/Volume\u Volume/haystack/*并将此命令的结果附加到文件/mnt/Volume\u Volume/log.txt。屏幕在其输出上显示注释,这就是您在日志文件中得到的内容 如果您确实想使用screen,正确的命令如下:
screen bash -c 'fgrep "needle" /mnt/Volume_volume/haystack/* >> /mnt/Volume_volume/log.txt'
但我怀疑很简单:
nohup fgrep "needle" /mnt/Volume_volume/haystack/* >> /mnt/Volume_volume/log.txt &
我也会为你工作