deawrias

Remove HTML tags or email adresses

Jan 7th, 2016
2,253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.78 KB | None | 0 0
  1. Remove HTML Tags
  2.  
  3. htmlTags="a|b|big|blockquote|body|br|center|code|del|div|em|font|h[1-9]|head|hr|html|i|img|ins|item|li|ol|option|p|pre|s|small|span|strong|sub|sup|table|td|th|title|tr|tt|u|ul"
  4. cat stage2 | sed -r "s/<[^>]*>//g;s/^\w.*=\"\w.*\">//;s/^($htmlTags)>//I;s/<\/*($htmlTags)$//I;s/&amp;*/&/gI;s/&quot;/\"/gI;s/&apos;/'/gI;s/&apos;/'/gI;s/&lt;/</gI;s/&pound;/£/gI" | sort -b -f -i -T "$(pwd)/" | uniq > stage3 && wc -l stage3 && rm stage2
  5.  
  6. or Email addresses
  7.  
  8. cat stage3 | sed -r "s/\w.*\@.*\.(ac|ag|as|at|au|be|bg|bill|bm|bs|c|ca|cc|ch|cm|co|com|cs|de|dk|edu|es|fi|fm|fr|gov|gr|hr|hu|ic|ie|il|info|it|jo|jp|kr|lk|lu|lv|me|mil|mu|net|nil|nl|no|nt|org|pk|pl|pt|ru|se|si|tc|tk|to|tv|tw|uk|us|ws|yu):*//gI" | sort -b -f -i -T "$(pwd)/" | uniq > stage4 && wc -l stage4 && rm stage3
Advertisement
Add Comment
Please, Sign In to add comment