#!/bin/bash 
l_min=12;
l_max=64;

# (A) Merge datasets into one file

# (A.1) cut seed part
for (( l=$l_min; l<=$l_max; l++ ))
do
    echo "(1/3) cut for l=$l ...";
    cat  main.weight.full.l${l}.txt | cut -f 2- > m.l${l}.txt
done

# (A.2) paste (merge) files
rm -f main.weight.full.txt
cat  main.weight.full.l${l_min}.txt | cut -f 1 > m_header.txt
command_line_paste="paste m_header.txt";
for (( l=$l_min; l<=$l_max; l++ ))
do
    command_line_paste="$command_line_paste m.l${l}.txt";
done
echo "(2/3) full paste !!";
`$command_line_paste > main.weight.full.txt`;

# (A.3) cleaning
echo "(3/3) clean";
rm -f m_header.txt
for (( l=$l_min; l<=$l_max; l++ ))
do
    rm -f m.l${l}.txt
done
