【发布时间】:2021-09-19 21:22:08
【问题描述】:
假设我有一个名为 URL.txt 的 URL 列表,我只想输出目录而不是 .html、.php 等文件或扩展名。如果它在 URL 中找到任何扩展名或任何文件脚本应该转到下一个 URL
- https://example.com/tradings/trade/trading?currency=usdt&dest=btc&tab=limit
- https://example.com/account/signup/accounts/signin/account.html
我想要这样的结果:
- https://example.com/tradings/
- https://example.com/tradings/trade/
- https://example.com/account/
- https://example.com/account/signup/
- https://example.com/account/signup/accounts/
- https://example.com/account/signup/accounts/signin/
我试过这个命令,但它不会转换成完整的 URL 端点。我想要一个没有任何扩展的完整 URL 端点。
cat Urls.txt | rev | cut -d'/' -f 2 | sort -u | rev
【问题讨论】: