Answers:
将file
变量设置为指向您的文件,修改openssl命令,您可以执行以下操作:
file="your file name"; first=""; for i in $(grep -n CERT "${file}" | cut -f 1 -d:)
do
if [ -z "$first" ]
then
first=$i
continue
fi
sed -n "$first,${i}p" "${file}" | openssl x509 -noout -subject
first=""
done
${file}
。