#!/bin/bash
# 执行方法 bash test.sh $FILENAME
function subtitle-list()
{
echo \” $( grep -e \”^\\[.*\\]\” $FILENAME | sed -e \’s/\\[//g \’ -e \’s/\\]//g\’ ) \”
}
function items()
{
sed -n -e \”/$1/,/\\[.*\\]/p\” $FILENAME | grep -v -e \”^$\” -e \”^#\” | sed -e \’/\\[.*\\]/d\’
}
count=1
FILENAME=$1
echo -e \”############### $FILENAME ##################\”
for i in `subtitle-list $FILENAME`
do
{
echo -e -n \”$count, $i, \” ; items $i | wc -l
echo \”*******\”
count=$(( $count + 1 ))
}
done