File size: 404 Bytes
e17516b 3ebe827 e17516b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
#!/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
|