求写个shell+正则表达式


shell内容

想要实现: 把输出结果中<html>开头,</html>结束的所有内容 > 放到 1.html 中
输出结果 > 1.html

正则表达式 shell

antiyyy 10 years ago

 echo "<html>anything you like</html>" |grep -oP "(?<=<html>)(.*)(?=</html>)"

output:


 anything you like

as you like:


 echo "<html>anything you like</html>" |grep -oP "(?<=<html>)(.*)(?=</html>)" > 1.html

Taiga answered 10 years ago

Your Answer