HTMLタグのフィルタリング

HTMLタグのフィルタリング

Chromeやその他から保存されているhtmlブックマークを使用して、フィルタリングして並べ替えるタグがあるhtmlファイルにエクスポートすることがよくあります<a href

<a href="https://<a-web-site>">Title of the website</a>

sed/grep/awk などの基本的な Linux ユーティリティを使用して項目をフィルタリングしてソートする方法は次のとおりです。

Title of the website https://<a-web-site>

ベストアンサー1

sedを使用してください:

$ echo '<a href="https://<a-web-site>">Title of the website</a>' | sed -e 's|.*href="\(.*\)".*>\(.*\)</a>|\2 \1|g'
Title of the website https://<a-web-site>

おすすめ記事