#!/bin/sh
#RCCP script by hampa@chello.se
#add a file to a segment group
#usage: rccp -s somemovie.mpg | ./seg_add gdlid 
#you can see the group id by doing a rccp -gl

#/GDLNEW gdlid|filesize|filename
#/GDLADD gdlid|nickname|remotefilename|remotefilesize 

#rccp -gn gid1 movie.mpg 526441776

if [ $# -eq 0 ]
then
	echo "usage: rccp -s filename | $0 gdlid"
	exit 1;
fi
glid=$1

while read -r line
do
echo $line | awk -F\| '{printf("'$glid' \"%s\" \"%s\" %s\n", $1, $2, $3)}' | xargs -exec rccp -ga  
done 
