How to remove XML tags from Unix command line?

后端 未结 5 1020
再見小時候
再見小時候 2021-01-31 18:43

I am grepping an XML File, which gives me output like this:

data
more data
...

Note, this is a fl

5条回答
  •  说谎
    说谎 (楼主)
    2021-01-31 19:10

    Use html2text command-line tool, which converts html into plain text.

    Alternatively you may try ex-way:

    ex -s +'%s/<[^>].\{-}>//ge' +%p +q! file.txt
    

    or:

    cat file.txt | ex -s +'%s/<[^>].\{-}>//ge' +%p +q! /dev/stdin
    

提交回复
热议问题