Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@MattiSG
Created August 25, 2012 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MattiSG/3471254 to your computer and use it in GitHub Desktop.
Save MattiSG/3471254 to your computer and use it in GitHub Desktop.
Make links from URL list
# Outputs an HTML <a> list from a list of URLs, fetching destination page titles on the go
# param = input file, in which URLs are stored, one per line
for url in $(cat $1)
do
echo '<a href="'$url'">'
curl "$url" 2> /dev/null | grep '<title>' -A 1 | tail -1 | tr -s ' '
echo '</a>'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment