Previous TOC Next | SortSDFiles.pl | Code | PDF | PDFGreen | PDFA4 | PDFA4Green

## NAME

SortSDFiles.pl - Sort SDFile(s) using values for a data field

## SYNOPSIS

SortSDFiles.pl SDFile(s)...

SortSDFiles.pl [-d, --detail infolevel] [-h, --help] [-k, --key SD data field name] [--keydata numeric | alphanumeric] [-o, --overwrite] [-r, --root rootname] [-s, --sort ascending | descending] [-w, --workingdir dirname] SDFile(s)...

## DESCRIPTION

Sort SDFile(s) using values for a specified data field name key. Only one SD data field name key can be specified for sorting. In an event of conflict during sorting process, two similar values for a SD data field name key are simply transferred to output files in order of their presence in input files. Additionally, compound records with no data field name, empty field values, or field values containing multiple lines are simply placed at the end. The file names are separated by space.The valid file extensions are .sdf and .sd. All other file names are ignored. All the SD files in a current directory can be specified either by *.sdf or the current directory name.

## OPTIONS

-d, --detail infolevel

  Level of information to print about compound records being ignored. Default: 1. Possible values: 1, 2 or 3.

-h, --help

  Print this help message.

-k, --key SD data field name

  SDFile(s) data field name used for sorting compound records. Default value: first data field name. Compound records with no sdfieldname, empty field values, field values containing multiple lines, or field values inappropriate for sorting are simply placed at the end.

--keydata numeric | alphanumeric

  Data type for sdfieldname values. Possible values: numeric or alphanumeric. Default value: numeric. For alphanumeric data values, comparison is case insensitive.

-o, --overwrite

  Overwrite existing files.

-r, --root rootname

  New SD file name is generated using the root: <Root>.<Ext>. Default new file name: <InitialSDFileName>SortedByDataField.<Ext>. This option is ignored for multiple input files.

-s, --sort ascending | descending

  Sorting order for SD data field values. Possible values: ascending or descending. Default value: ascending.

-w, --workingdir dirname

  Location of working directory. Default: current directory.

## EXAMPLES

To perform numerical sort in ascending order using first data field values and generate a new SD file NewSample1.sdf, type:

% SortSDFiles.pl -o -r NewSample1 Sample1.sdf

To perform numerical sort in descending order using MolWeight data field and generate a new SD text file NewSample1.sdf, type:

% SortSDFiles.pl -k MolWeight --keydata numeric -s descending -r NewSample1 -o Sample1.sdf

## AUTHOR

Manish Sud

## SEE ALSO

JoinSDFiles.pl, MergeTextFilesWithSD.pl, SplitSDFiles.pl, SDFilesToHTML.pl

## COPYRIGHT

Copyright (C) 2015 Manish Sud. All rights reserved.

This file is part of MayaChemTools.

MayaChemTools is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

Previous TOC Next | March 29, 2015 | SortSDFiles.pl