Get content between a pair of HTML tags using Bash

前端 未结 6 644
野趣味
野趣味 2020-11-30 09:53

I need to get the HTML contents between a pair of given tags using a bash script. As an example, having the HTML code below:



         


        
6条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-30 10:46

    Another option is to use the multi-platform xidel utility (home page on SourceForge, GitHub repository), which can handle both XML and HTML:

    xidel in.html  -e '/html/body/node()' --printed-node-format=html
    

提交回复
热议问题