コマンドラインでWebページのURLを抽出する方法

Nid: 710
  • lynx
$ lynx -dump "http://octaviadata.com" | grep -o 'http[s]*://.*'
  • curl
$ curl "http://octaviadata.com" 2>&1 | grep -o -E 'href="([^"#]+)"' | cut -d'"' -f2
これでは行内に複数のhrefがある場合に、データを失う。