Friday, July 29, 2011

Get links from a page with bash

Get anchor elements from a webpage can be done with

curl URL 2>&1 | grep -o -E 'href="([^"#]+)"' | cut -d'"' -f2


where you replace URL with your choice, just like here:
curl http://cookpad.com 2>&1 | grep -o -E 'href="([^"#]+)"' | cut -d'"' -f2

8 comments:

  1. Thanks for the little script, still useful two years later :-)

    ReplyDelete
  2. Still useful in 2016.. thanks

    ReplyDelete
  3. And still useful in 2021. Thanks !

    ReplyDelete
  4. I know this is one of the most meaningful information for me. And I'm animated reading your article. But should remark on some general things, the website style is perfect; the articles are great. Thanks for the ton of tangible and attainable help. Unique domain backlinks

    ReplyDelete