#!/bin/sh
#
# retrieve the OSM-userid for a given username
#
# the script reads single usernames from stdin and outputs the username and
# the corresponding ID
#


USER_URL="http://openstreetmap.org/user"

get_user_id() {
	wget -q -O - "$USER_URL/$1" | grep "/message/new/" | cut -d '"' -f 2 | cut -d / -f 4
}

while read username
  do	echo -ne "$username\t"
		get_user_id "$username"
 done