Extract or Filter SD file

How to extract SD file with given input of parameters. For example: SD file contains 1000 structures with IDS, I want to extract 400 Structures SD file.