If you have any question or comment, please send an e-mail to the <a href="mailto:master@abc.com">webmaster</a>.</pre></tt><br></td></tr></table><br>
<center><img src=/cgi-bin/dream/dream.cgi?id=test></center></body>
</html>
期望得到的文本:
Welcome Page
If you have any question or comment, please send an e-mail to the webmaster.
谢谢大家。 作者: moperyblue 时间: 2016-06-21 10:36 本帖最后由 moperyblue 于 2016-06-21 11:18 编辑
拿来主义,谷歌 html2txt,分分钟搞定咯……作者: jason680 时间: 2016-06-21 10:51
$ awk '{gsub("<[^>]+>","")}!sub("^[\t ]*$","")' FILE
Welcome Page
If you have any question or comment, please send an e-mail to the webmaster.
perl -nle '@a=/(?:\A|(?<=>))[^<>]+(?=<)/g;print @a if(@a)' f
复制代码
Welcome Page
If you have any question or comment, please send an e-mail to the webmaster. 作者: 251744647 时间: 2016-06-21 16:29
sed 's/<[^>]*>//g;/^$/d' FILE作者: sunzhiguolu 时间: 2016-10-03 21:19
perl -nle 's{</?[^>]+>}{}g;print if(length)' f
复制代码
作者: moperyblue 时间: 2016-10-04 17:26
awk '{gsub(/<[^>]*>/,"")}NF'
复制代码
作者: jcdiy0601 时间: 2016-10-08 10:51
sed 's/<[^<]*>//g;/^$/d' file
Welcome Page
If you have any question or comment, please send an e-mail to the webmaster.