查找目录下包含特定字符串的文件

查找日志目录下空间超额的任务

> find log -name *err | xargs grep 'Disk quota exceeded'
log/SRR8117383_download.err:gzip: stdout: Disk quota exceeded
log/SRR8117375_download.err:gzip: stdout: Disk quota exceeded
log/SRR8117368_download.err:gzip: stdout: Disk quota exceeded
log/SRR8117367_download.err:gzip: stdout: Disk quota exceeded
log/SRR8117367_download.err:gzip: stdout: Disk quota exceeded
log/SRR8117364_download.err:gzip: stdout: Disk quota exceeded
log/SRR8117382_download.err:cat: write error: Disk quota exceeded
log/SRR8117382_download.err:cat: write error: Disk quota exceeded
log/SRR8117446_download.err:gzip: stdout: Disk quota exceeded
log/SRR8117384_download.err:gzip: stdout: Disk quota exceeded
log/SRR8117362_download.err:gzip: stdout: Disk quota exceeded
log/SRR8117380_download.err:gzip: stdout: Disk quota exceeded
log/SRR8117413_download.err:gzip: stdout: Disk quota exceeded
log/SRR8117396_download.err:gzip: stdout: Disk quota exceeded
log/SRR8117370_download.err:gzip: stdout: Disk quota exceeded
log/SRR8117421_download.err:gzip: stdout: Disk quota exceeded
log/SRR8117378_download.err:gzip: stdout: Disk quota exceeded
log/SRR8117393_download.err:gzip: stdout: Disk quota exceeded
log/SRR8117393_download.err:gzip: stdout: Disk quota exceeded
log/SRR8117373_download.err:gzip: stdout: Disk quota exceeded
log/SRR8117433_download.err:gzip: stdout: Disk quota exceeded

删除错误的日志

find log -name *err | xargs grep 'Disk quota exceeded' | awk -F: '{print $1}' | uniq | xargs rm

得到错误的任务号

find log -name *err | xargs grep '117407' | cut -b 5-14 | uniq

shengtinggroup

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值