小编wan*_*rry的帖子

Bash 命令 find 与 exec 和 grep 无法正常工作,有什么问题吗?

我想用关键字 ALARM/FATAL 将日志文件过滤到另一个备份文件中,假设我有以下两个文件

\n
[root@TENCENT64 /tmp/test]# cat test_ccd.log \nccd0.log:01-28 09:33:18:461 1254 F NORMAL\nccd0.log:01-28 09:33:18:461 1254 F FATAL \nccd0.log:01-28 09:34:30:827 1254 E ALARM\n[root@TENCENT64 /tmp/test]# cat test_mcd.log \nmcd0.log:01-29 09:33:18:461 1254 F NORMAL\nmcd0.log:01-29 09:33:18:461 1254 F FATAL \nmcd0.log:01-29 09:34:30:827 1254 E ALARM\n
Run Code Online (Sandbox Code Playgroud)\n

我想生成以下备份文件

\n
[root@TENCENT64 /tmp/test]# cat test_ccd.log.txt\nccd0.log:01-28 09:33:18:461 1254 F FATAL \nccd0.log:01-28 09:34:30:827 1254 E ALARM\n[root@TENCENT64 /tmp/test]# cat test_mcd.log.txt\nmcd0.log:01-29 09:33:18:461 1254 F FATAL \nmcd0.log:01-29 09:34:30:827 1254 E ALARM\n
Run Code Online (Sandbox Code Playgroud)\n

我尝试了以下命令来实现该目的,但它们都没有成功,请有人帮助纠正我做错的任何事情?

\n
[root@TENCENT64 /tmp/test]# cat /etc/redhat-release \nCentOS Linux release 7.2 (Final)\n\n# this …
Run Code Online (Sandbox Code Playgroud)

bash find centos

2
推荐指数
1
解决办法
215
查看次数

标签 统计

bash ×1

centos ×1

find ×1