きんめも

語彙力がヤバイ

grepでURLを検索(正規表現)

URLっぽい文字列を検索

index.htmlは適当に変えてください.

# grep -Eo "http(s?)://(\w|:|%|#|\$|&|\?|\(|\)|~|\.|=|\+|\-|/)+" index.html

ヒット例

http://www.slideshare.net/kinmemodoki
http://kinmemodoki.hatenablog.com/
https://hacku.kinmemodoki.net
https://fonts.googleapis.com/css?family=Open+Sans:300

htmlのhref/src属性のURLだけ欲しい場合

# grep -Eo "(?i)(href|src)\s*=\s*(\"|')http(s?)://(\w|:|%|#|\$|&|\?|\(|\)|~|\.|=|\+|\-|/)+(\"|')" index.html