<p style="margin: 10px auto; padding-top: 0px; padding-bottom: 0px; font-family: verdana, 'ms song', 宋体, Arial, 微软雅黑, Helvetica, sans-serif; line-height: 21.6px;">例如有个文本文件</p><p style="margin: 10px auto; padding-top: 0px; padding-bottom: 0px; font-family: verdana, 'ms song', 宋体, Arial, 微软雅黑, Helvetica, sans-serif; line-height: 21.6px;">1234 ji</p><p style="margin: 10px auto; padding-top: 0px; padding-bottom: 0px; font-family: verdana, 'ms song', 宋体, Arial, 微软雅黑, Helvetica, sans-serif; line-height: 21.6px;">adfa jiji</p><p style="margin: 10px auto; padding-top: 0px; padding-bottom: 0px; font-family: verdana, 'ms song', 宋体, Arial, 微软雅黑, Helvetica, sans-serif; line-height: 21.6px;">adfasd qqwe</p><p style="margin: 10px auto; padding-top: 0px; padding-bottom: 0px; font-family: verdana, 'ms song', 宋体, Arial, 微软雅黑, Helvetica, sans-serif; line-height: 21.6px;"> // 注意一定要有个回车,这样脚本才会读到最后一行 </p><div>
</div>
while read typeline
do
#get line txt
typeInf=$typeline
#get type
#去除右边第一个空格开始的后边所有字符
typetmp=${typeInf%% *}
#judge type same
if [ "$typetmp" = "$type" ]
then
echo sametype:$typetmp
#get count
pcount=${typeInf:0-1}
fi
done < $file