#! /bin/bash
# Moves to another directory all SMILES containing a sulphur atom which
# appears not to present a standard valence. These SMILES should be checked, 
# in many cases, they are coordination compounds with correct brackets around
# the sulphur.

[ -d ../working ] || mkdir ../working
for i in `ls *.smi` ; do
   radical=no
   dato=`cat $i | grep [[]S[]]`
   if [ "$dato" != "" ]; then
     radical=si
   else  
     dato=`cat $i | grep [[]SH[]]`
     if [ "$dato" != "" ]; then
       radical=si
     fi
   fi
   if [ "$radical" == "si" ]; then
       mv $i ../working
   fi
done
