#!/bin/bash

# makepanels.sh - Create PCD panels for blreads  menus.

# Synopsis: makepanels.sh infile

#    infile - a template file containing a PCD panel for file chooser items 
#        This script creates an output file called 'panels', that must be pasted
#        into the .blmenu file in a text editor.
#        
#        infile must be rnaspades.txt if the panel is to be pasted into rnaspades.blmenu
#            

infile=$1
outfile=spanels
begin=1
end=6

# infile is query term 2 
cat $infile > $outfile

# keep apending a copy of infile to the output, each time,
# incrementing the number of the query term in all relevant fields
for ((i=$begin+1; i <=$end; i++))
do
    echo $i
    cat $infile | \
    sed -e "s/SE1/SE$i/g" |\
    sed -e "s/SE read file 1/SE read file $i/g" |\
    cat >> $outfile
done
