#!/bin/bash

# Appends the title of a URL in the format of 
# "# Title\nURL\n\n"
while read -r URL; do
    TITLE=`curl -L "$URL" | grep -o "<title>.*</title>" | sed -E "s/<title>(.*)<\/title>/\1/"`
    printf "# $TITLE\n$URL\n\n"
done
