Bash 脚本不是我的强项。我有一个结构为
% comment
filename1 pattern-to-search1
filename1 pattern-to-search2
...
我想为文件中的每一行编写一个脚本来 grep for all filename
。pattern-to-mat
到目前为止我有
while read file p
do
if [ "${file:0:1}" != "%" ]
then
grep -o "$p" $file | wc -l
fi
done
echo -e "\nDone."
但它不会跳过以%
. 有任何想法吗?