branch / collect.sh
zeio's picture
fix(index): updated folders in index, added collection script
e17516b verified
raw
history blame
401 Bytes
#!/bin/bash
set -e
keyphrase=$1
folder=$2
if test -z "$keyphrase"; then
echo 'Keyphrase must not be empty'
exit
fi
if test -z "$folder"; then
echo 'Target folder name must not be empty'
exit
fi
i=0
mkdir -p "$folder"
for file in $(cat index.tsv | grep "$keyphrase" | awk '{printf("threads/%s/%08d.txt\n", $NF, $1)}'); do
cp $file $folder/$(printf "%04d" "$i").txt
i=$((i + 1))
done