【发布时间】:2017-05-11 09:25:00
【问题描述】:
我正在尝试通过 shell 脚本从存储在目录中的一组文件中 grep 特定模式。然而,脚本扫描文件,但它没有给我结果。我有 5 个文件,格式为 finishing with status COMPLETE
这是代码,请您帮忙解决问题
#!/bin/bash
dt=$(date --d='7 day ago' +'%Y%m%d')
countT=$("find /home/arun/file_status -type f -name "product_feed_*stock*_${dt}*.out" -exec grep "finishing with status COMPLETE" {} \;" | wc -l)
echo $countT
if [ $countT -eq 5 ]
then
echo "Hello"
else
echo "Hai"
fi
以下是错误:
find /home/arun/file_status -type f -name product_feed_stock_20170504*.out -exec grep Finishing: No such file or directory 0 Hai
【问题讨论】:
-
下面是错误 find /home/arun/file_status -type f -name product_feed_stock_20170504*.out -exec grep Finishing: No such file or directory 0 Hai