ICM has a number of different scripts that are useful for this
type of exercise which can be found in the directory
$ICMHOME/molpipe in your ICM distribution. Read more about pipes in ICM here.
So for example if you wanted to filter the Enamine REAL database by Molecular Weight (MW) you could use the following scripts
#for chemicals <200 MW
cat /gigadata/chem/REAL_2024/Enamine_REAL_HAC_27_872M_CXSMILES.cxsmiles | molrdsmi.icm id=id smi=smiles -header | molfilter.icm "MolWeight(mol)<200" | mol2smi.icm > small_mols1.tsv
# for chemicals <500 MW
cat /gigadata/chem/REAL_2024/Enamine_REAL_HAC_26_766M_CXSMILES.cxsmiles | molrdsmi.icm id=id smi=smiles -header | molfilter.icm "MolWeight(mol)<500" | mol2smi.icm > small_mols2.tsv