<commit_before><commit_msg>added search and delete bash script<commit_after>SEARCH=$1
if [ -z "${SEARCH}" ]
then
  echo 'Usage: dropshare-delete <search-term>'
  echo 'You will be asked for confirmation before deleting files and db entries'
  exit 1
fi

KEYS=`redis-cli keys '*'`
for KEY in $KEYS
do
  JSON=`redis-cli GET $KEY`

  if [ -z `echo $JSON | grep -i "${SEARCH}"` ]
  then
    continue
  fi

  echo "$KEY: "
  echo $JSON | python -mjson.tool
  echo "Delete '$KEY'? [N/y]"
  read YN
  
  if [ "$YN" == "y" ]
  then
    SHA1=`echo $JSON | python -mjson.tool | grep sha1checksum | cut -d'"' -f4`
    rm "files/${SHA1}"
    redis-cli DEL "$KEY"
  fi
done
{'fraction_non_alphanumeric': 0.15303030303030302, 'fraction_numerical': 0.00909090909090909, 'mean_word_length': 3.080246913580247, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1850666', 'n_tokens_mistral': 262, 'n_tokens_neox': 248, 'n_words': 82}