branch / collect.sh
zeio's picture
feat(threads): pulled more threads, updated collection script to ignore character case in the key phrase
3ebe827 verified
raw
history blame contribute delete
404 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 -i "$keyphrase" | awk '{printf("threads/%s/%08d.txt\n", $NF, $1)}'); do
cp $file $folder/$(printf "%04d" "$i").txt
i=$((i + 1))
done