#!/bin/bash
#M extracturl extracts bookmarks from bookmarks.html
#***************************************************
#
# Script Name: extracturl 
# extracts bookmarks from bookmarks.html
# and creates files per bookmark from it in directory pfad
# Developed by Bruno Brueckmann 2012
#***************************************************
filename=$*
mkdir /tmp
pfad=/tmp/bookmarks
rm $pfad
mkdir $pfad
tempfile=/tmp/extracturl.tmp
lynx --dump ${filename}| egrep  -e "https?:.*"  >$tempfile
N=0
cat $tempfile | while read LINE ; do
	N=$((N+1))
       link=`echo ${LINE}|awk '{ print $2}'`  
	echo "Line $N = $link"
        temp=`cat ${filename}|grep "${link}"`
        temp1=`echo ${temp%</A>}` 
        name=`echo ${temp1##*>}`
        echo "URL=$link >$pfad/${name}"
        echo "URL=$link"  >"$pfad/${name}"
done





