Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/289.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
grep中的逃逸空间_Grep - Fatal编程技术网

grep中的逃逸空间

grep中的逃逸空间,grep,Grep,以上工作如预期,并显示了今天的结果。但以下方法不起作用 tail /mnt/mysqld_log/mysql_error_log.err | grep -e `date +'%y%m%d' --date='4 hour ago'` | more 120824 11:25:06 [ERROR] /usr/libexec/mysqld: Table '.zone_assoc' is marked as crashed and should be repaired 120824 18:03:23

以上工作如预期,并显示了今天的结果。但以下方法不起作用

tail /mnt/mysqld_log/mysql_error_log.err  | grep -e `date +'%y%m%d' --date='4 hour ago'` | more

120824 11:25:06 [ERROR] /usr/libexec/mysqld: Table '.zone_assoc' is marked as crashed and should be repaired
120824 18:03:23 [ERROR] /usr/libexec/mysqld: Incorrect key file for table '.ad_zone_assoc.MYI'; try to repair it
120824 18:08:38 [ERROR] /usr/libexec/mysqld: Incorrect key file for table '.ad_zone_assoc.MYI'; try to repair it
我试图逃离这个空间,但没有成功

tail /mnt/mysqld_log/mysql_error_log.err  | grep -e `date +'%y%m%d %k' --date='4 hour ago'` | more

grep: 18: No such file or directory

您需要将
date
命令用引号括起来:

tail /mnt/mysqld_log/mysql_error_log.err  | grep -e `date +'%y%m%d\ %k' --date='4 hour ago'` | more

grep: Trailing backslash

空间被解释为您试图读取的文件,通过将其括在引号中,这不会发生。

确切的cron命令是什么?您可能需要将其放入包装器脚本中才能按预期工作,但请将cron发送给我,我将看看我能做些什么。cron条目在转义%符号后工作。谢谢你的快速帮助。
tail /mnt/mysqld_log/mysql_error_log.err  | grep -e "`date +'%y%m%d %k' --date='4 hour ago'`" | more