#!/bin/sh
#cat bor-2007-03-29 | sed -e '/[0-9][0-9]:[0-9][0-9] \/\//d;/[0-9][0-9]:[0-9][0-9] \*/d;/[0-9][0-9]:[0-9][0-9] \/\*\*/d;/[0-9][0-9]:[0-9][0-9] this\./d' | sed -e '/[0-9][0-9]:[0-9][0-9] cutty/d' | sed -e '/\([0-9][0-9]:[0-9][0-9] \([^ \t]*\) [a-z]:\)\|\([^~]http\)\|\([0-9][0-9]:[0-9][0-9] \([^ \t]\) [0-9]+:\)/!d'
#
#cat all_logs | \
# sed -e '/bordom\.net/d' | \
# sed -e "s/bor-2007-\([0-9][0-9]-[0-9][0-9]\) \([0-9][0-9]:[0-9][0-9]\) \([^ \t]\+\) .*http\([^ \t]\+\)/INSERT INTO items (url,title,author,source,mimetype,time,updated,queued,public) VALUES (\"http\4\", ftitlef, \"\3\", \"#bor\", fmimetypef, \"\1\2\", \"\1\2\", 1, 0)/g" | \
# sed -e '/http/!d' | \
for file in `ls bor*`;do cat $file | sed -e '/[0-9][0-9]:[0-9][0-9] \/\//d;/[0-9][0-9]:[0-9][0-9] \*/d;/[0-9][0-9]:[0-9][0-9] \/\*\*/d;/[0-9][0-9]:[0-9][0-9] this\./d' | sed -e '/[0-9][0-9]:[0-9][0-9] cutty/d' | sed -e '/\([0-9][0-9]:[0-9][0-9] \([^ \t]*\) [a-z]:\)\|\([^~]http\)\|\([0-9][0-9]:[0-9][0-9] \([^ \t]\+\) [0-9]\+:\)/!d' | sed -e "s/^\(.*\)/$file \1/g" >> all_logs;done
cat all_logs | \
sed -e '/bordom\.net/d' | \
sed -e "s/bor-2007-\([0-9][0-9]-[0-9][0-9]\) \([0-9][0-9]:[0-9][0-9]\) \([^ \t]\+\) .*http\([^ \t]\+\)/http\4\tftitlef\t\3\t#bor\tfmimetypef\t\1 \2\t\1 \2\t1\t0/g" | \
sed -e '/http/!d' >> all_posts
#while IFS="\t" read a b c d e f g h;do b=$(links -source "$a" | sed -e '//!d' | sed -e '/<\/title>/!d' | sed -e 's/.*\(.*\)<\/title>.*/\1/g'); f=$(date --utc --date "2007-$f" +%s); g=$(echo "$f"); echo "$a,$b,$c,$d,$e,$f,$g,$h";done test
#while IFS=" " read a b c d e f g h;do b=$(echo "hi" | sed -e '//!d' | sed -e '/<\/title>/!d' | sed -e 's/.*\(.*\)<\/title>.*/\1/g'); f=$(date --utc --date "2007-$f" +%s); g=$(echo "$f"); echo "$a\t$b $c $d $e $f $g $h";done restore.sql
#while IFS=, read a b c d e f g h;do b=$(links -source "$a" | sed -e '//!d' | sed -e '/<\/title>/!d' | sed -e 's/.*\(.*\)<\/title>.*/\1/g'); f=$(date --utc --date "2007-$f" +%s); g=$(echo "$f"); echo "INSERT INTO items (url,title,author,source,mimetype,time,updated,queued,public) VALUES ($a,$b,$c,$d,$e,$f,$g,$h);";done restore.sql
while IFS=" " read a b c d e f g h;do b=$(echo "put title parser here"); e=$(echo "put mimetype parser here"); f=$(date --utc --date "2007-$f" +%s); g=$(echo "$f"); echo "INSERT INTO items (url,title,author,source,mimetype,time,updated,queued,public) VALUES ('$a','$b','$c','$d','$e','$f','$g','$h');";done restore.sql
rm all_posts
rm all_logs