代码: 全选
title: test
<T1>
123
</T1>
Tag for T1 is 123
<T2>
321
</T2>
请问要用什么命令来实现这个判断,grep, sed? 用最简单的方法来实现就可以了,不用获取标签之间的内容,只要判断有没有标签就行了.
谢谢.
Thanks for your help, actually the problem is not so difficult as you guys thought. My poor expression misleaded. Below is the solution I used(There is no Chinese input available in Lab, so I just post in English.):
----------------------------------solution begin----------------------------------------------------------------
代码: 全选
#calcuate how many tags in the file
tagsNumber=$(egrep -c '/*<T' source.txt)
#do if there is tag in the file
while [ $tagsNumer -gt 0 ]; do
...... ....
# I will remove one tag(in pair) each time, so re-calculate it
tagsNumber=$(egrep -c '/*<T' source.txt)
done #end of while loop