#! /bin/bash
# Moves to another directory all SMILES containing an aromatic nitrogen 
# atom which appears with brackets. These SMILES should be checked, 
# in many cases, they are coordination compounds, the nitrogen is cationic
# or has an H-atom that needs to be explicit, brackets being correct. 

[ -d ../working ] || mkdir ../working
for i in `ls *.smi` ; do
   dato=`cat $i | grep [[]n[]]`
   if [ "$dato" != "" ]; then
     echo $dato
     mv $i ../working
   else
     dato=`cat $i | grep [[]n+[]]`
     if [ "$dato" != "" ]; then
       echo $dato
       mv $i ../working
     else
       dato=`cat $i | grep [[]nH`
       if [ "$dato" != "" ]; then
         echo $dato
         mv $i ../working
       fi
     fi
   fi
done
