0
我正在編寫一個shell腳本,作爲它的一部分,它會抓取一個網頁以獲取提交消息。它會看起來像這樣的輸出:帶sed的html標籤
Fix function <code>something_or_other()</code>, with a helpful fix from <a href="https://somewebsite.com">somebody</a>. <br>
Also, fix <a href=somewhere>another thing</a>
而且我希望腳本輸出這樣的:
Fix function something_or_other(), with a helpful fix from somebody. Also, fix another thing.
有沒有辦法從與正則表達式做這一邊?我很清楚使用正則表達式解析HTML的dangers,但這似乎是唯一的選擇。我不想使用太多無處不在的外部程序(例如,GNU sed已經出來,但是POSIX sed很好)。
http://stackoverflow.com/documentation/command-line/7613/parsing-html-using-xmllint-on-a-unix-like-terminal#t = 201610270431550442455這是一項正在進行的工作。如果你發佈了一個你正在解析的html的例子,我不介意幫你找到一個強大的解決方案。 –