Created
July 31, 2011 11:06
-
-
Save cyfdecyf/1116703 to your computer and use it in GitHub Desktop.
A small script to extract all the href links from a web page.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ $# != 1 ]]; then | |
echo "Usage: $0 <URL>" | |
exit 1 | |
fi | |
# curl -s means silent | |
# grep -o means only print matched text | |
curl -s $1 | grep -o '<a *href *= *"[^"]*"' | cut -d '"' -s -f 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment