#!/usr/bin/env bash
shuf --random-source=random-file icd_labels_$1_tok_bpe32.txt > data.$1
shuf --random-source=random-file icd_labels_$2_tok_bpe32.txt > data.$2
x=`wc -l data.$1 | cut -f1 -d' '`
echo $x
a=$(($x*8/10))
b=$(($x - $a))
c=$(($b/2))
d=$c
echo "Splitting by ($a,$b,$c,$d)..."
head -n$a data.$1 > train.$1
head -n$a data.$2 > train.$2
tail -n$b data.$1 > atad.$1
tail -n$b data.$2 > atad.$2
head -n$c atad.$1 > dev.$1
head -n$c atad.$2 > dev.$2
tail -n$d atad.$1 > test.$1
tail -n$d atad.$2 > test.$2
wc -l *.$1
wc -l *.$2
cd ..
