Bash: Telephone number reverse search

Here is a small bash function that helps you.

Add this to your .bashrc

function numsearch {
   curl -s -k "http://www.dastelefonbuch.de/?kw=$1&s=a20000&cmd=search&ort_ok=0&sp=3&vert_ok=0&aktion=23"  | grep -e '$id=' -e 'na=' | cut -d "&" -f 5-9 | sed -e 's/na=//' -e 's/&st=/, /' -e 's/&hn=/ /' -e 's/&pc=/, /' -e 's/&ci=/ /' -e 's/\+/ /g' -e 's/%C4/Ä/g' -e 's/%D6/Ö/g' -e 's/%E4/ä/g' -e 's/F6/ö/g' -e 's/%FC/ü/g' -e 's/%DF/ß/g' -e 's/%26/ü/g'
}

The script fetches a German webpage with curl, searches for the right line and makes it human readable.

And afterwards you can simple use the function by typing this command numsearch 08131760

Tagged