#!/bin/bash
#
# Converts a newsreader ".rc" file to pimppa sql database
#
# Format of .rc file is supposed to be 
# <groupname> <last_read_counter>
#

#####################################################

if [ ! $1 ] ; then
    echo "Usage: rc2sql <rcfile>"
	exit
fi

cat "$1" | while read GROUP LASTNUM;
do
	mysql --execute="USE pimppa;INSERT INTO p_groups (g_name, g_last) VALUES (\"$GROUP\", $LASTNUM);"
	
#	echo Grp : $GROUP 
#	echo Last: $LASTNUM
done

