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

5 comments: