YahooパイプラインのRSSコンテンツから特定のリンクを正規表現に変換する方法は?

YahooパイプラインのRSSコンテンツから特定のリンクを正規表現に変換する方法は?

指定されたhrefリンクを除いて、RSSコンテンツからすべてのコンテンツを削除したいと思います。

例:

<div class='text'>
<div class="center"> <b><a rel="nofollow" target="_blank" href="http://domain1.com/html/12345948/howto.pdf"></a></b> </div>
</div>
<br>
<div class='text'>
<div class="center"> <b><a rel="nofollow" target="_blank" href="http://www.domain2.com/php/8mgfjghf/file.html">file</a></b>

<b><a rel="nofollow" target="_blank" href="http://www.domain1.com/78/78.html">78</a></b>

<b><a rel="nofollow" target="_blank" href="https://www.domain3.com/5k9f"></a></b> </div>
</div>

最終出力は次のとおりです。

http://domain1.com/html/12345948/howto.pdf
http://www.domain2.com/php/8mgfjghf/file.html
http://www.domain1.com/78/78.html
https://www.domain3.com/5k9f

また、ドメイン名は固定されています。つまり、domain4.netが存在する場合は、出力に表示したくありません。

ベストアンサー1

正規表現のみを使用する必要がありますか?これは提供された例で動作します。

cat file | grep href | sed 's/.*href=\"//g' | cut -d\" -f1

おすすめ記事