0
|
1 <html>
|
|
2 <head>
|
|
3 <title>MayaChemTools:Documentation:SortTextFiles.pl</title>
|
|
4 <meta http-equiv="content-type" content="text/html;charset=utf-8">
|
|
5 <link rel="stylesheet" type="text/css" href="../../css/MayaChemTools.css">
|
|
6 </head>
|
|
7 <body leftmargin="20" rightmargin="20" topmargin="10" bottommargin="10">
|
|
8 <br/>
|
|
9 <center>
|
|
10 <a href="http://www.mayachemtools.org" title="MayaChemTools Home"><img src="../../images/MayaChemToolsLogo.gif" border="0" alt="MayaChemTools"></a>
|
|
11 </center>
|
|
12 <br/>
|
|
13 <div class="DocNav">
|
|
14 <table width="100%" border=0 cellpadding=0 cellspacing=2>
|
|
15 <tr align="left" valign="top"><td width="33%" align="left"><a href="./SortSDFiles.html" title="SortSDFiles.html">Previous</a> <a href="./index.html" title="Table of Contents">TOC</a> <a href="./SplitSDFiles.html" title="SplitSDFiles.html">Next</a></td><td width="34%" align="middle"><strong>SortTextFiles.pl</strong></td><td width="33%" align="right"><a href="././code/SortTextFiles.html" title="View source code">Code</a> | <a href="./../pdf/SortTextFiles.pdf" title="PDF US Letter Size">PDF</a> | <a href="./../pdfgreen/SortTextFiles.pdf" title="PDF US Letter Size with narrow margins: www.changethemargins.com">PDFGreen</a> | <a href="./../pdfa4/SortTextFiles.pdf" title="PDF A4 Size">PDFA4</a> | <a href="./../pdfa4green/SortTextFiles.pdf" title="PDF A4 Size with narrow margins: www.changethemargins.com">PDFA4Green</a></td></tr>
|
|
16 </table>
|
|
17 </div>
|
|
18 <p>
|
|
19 </p>
|
|
20 <h2>NAME</h2>
|
|
21 <p>SortTextFiles.pl - Sort TextFile(s) using values for a column</p>
|
|
22 <p>
|
|
23 </p>
|
|
24 <h2>SYNOPSIS</h2>
|
|
25 <p>SortTextFiles.pl TextFile(s)...</p>
|
|
26 <p>SortTextFiles.pl [<strong>-d, --detail</strong> infolevel] [<strong>-h, --help</strong>] [<strong>--indelim</strong> comma | semicolon] [<strong>-k, --key</strong> colnum | collabel]
|
|
27 [<strong>--keydata</strong> numeric | alphanumeric] [<strong>-m, --mode</strong> colnum | collabel] [<strong>-o, --overwrite</strong>]
|
|
28 [<strong>--outdelim</strong> comma | tab | semicolon] [<strong>-q, --quote</strong> yes | no] [<strong>-r, --root</strong> rootname]
|
|
29 [<strong>-s, --sort</strong> ascending | descending] [<strong>-w, --workingdir</strong> dirname] TextFile(s)...</p>
|
|
30 <p>
|
|
31 </p>
|
|
32 <h2>DESCRIPTION</h2>
|
|
33 <p>Sort <em>TextFile(s)</em> using values for a key column specified by a column number or label.
|
|
34 Only one column key can be specified for sorting. In an event of conflict during sorting
|
|
35 process, two similar values for a column key are simply transferred to output files in
|
|
36 order of their presence in input files. Additionally, rows with empty or inappropriate
|
|
37 values for column key are simply placed at the end. The file names are separated by space.
|
|
38 The valid file extensions are <em>.csv</em> and <em>.tsv</em> for comma/semicolon and tab delimited
|
|
39 text files respectively. All other file names are ignored. All the text files in a
|
|
40 current directory can be specified by <em>*.csv</em>, <em>*.tsv</em>, or the current directory
|
|
41 name. The <strong>--indelim</strong> option determines the format of <em>TextFile(s)</em>. Any file
|
|
42 which doesn't correspond to the format indicated by <strong>--indelim</strong> option is ignored.</p>
|
|
43 <p>
|
|
44 </p>
|
|
45 <h2>OPTIONS</h2>
|
|
46 <dl>
|
|
47 <dt><strong><strong>-d, --detail</strong> <em>infolevel</em></strong></dt>
|
|
48 <dd>
|
|
49 <p>Level of information to print about lines being ignored. Default: <em>1</em>. Possible values:
|
|
50 <em>1, 2 or 3</em>.</p>
|
|
51 </dd>
|
|
52 <dt><strong><strong>-h, --help</strong></strong></dt>
|
|
53 <dd>
|
|
54 <p>Print this help message.</p>
|
|
55 </dd>
|
|
56 <dt><strong><strong>--indelim</strong> <em>comma | semicolon</em></strong></dt>
|
|
57 <dd>
|
|
58 <p>Input delimiter for CSV <em>TextFile(s)</em>. Possible values: <em>comma or semicolon</em>.
|
|
59 Default value: <em>comma</em>. For TSV files, this option is ignored and <em>tab</em> is used as a
|
|
60 delimiter.</p>
|
|
61 </dd>
|
|
62 <dt><strong><strong>-k, --key</strong> <em>col number | col name</em></strong></dt>
|
|
63 <dd>
|
|
64 <p>This value is mode specific. It specifies which column to use for sorting <em>TextFile(s)</em>.
|
|
65 Possible values: <em>col number or col label</em>. Default value: <em>first column</em>.</p>
|
|
66 </dd>
|
|
67 <dt><strong><strong>--keydata</strong> <em>numeric | alphanumeric</em></strong></dt>
|
|
68 <dd>
|
|
69 <p>Data type for column key. Possible values: <em>numeric or alphanumeric</em>. Default value:
|
|
70 <em>numeric</em>. For <em>alphanumeric</em> data values, comparison is case insensitive.</p>
|
|
71 </dd>
|
|
72 <dt><strong><strong>-m, --mode</strong> <em>colnum | collabel</em></strong></dt>
|
|
73 <dd>
|
|
74 <p>Specify how to sort text files: using column number or column label.
|
|
75 Possible values: <em>colnum or collabel</em>. Default value: <em>colnum</em>.</p>
|
|
76 </dd>
|
|
77 <dt><strong><strong>-o, --overwrite</strong></strong></dt>
|
|
78 <dd>
|
|
79 <p>Overwrite existing files.</p>
|
|
80 </dd>
|
|
81 <dt><strong><strong>--outdelim</strong> <em>comma | tab | semicolon</em></strong></dt>
|
|
82 <dd>
|
|
83 <p>Output text file delimiter. Possible values: <em>comma, tab, or semicolon</em>
|
|
84 Default value: <em>comma</em>.</p>
|
|
85 </dd>
|
|
86 <dt><strong><strong>-q, --quote</strong> <em>yes | no</em></strong></dt>
|
|
87 <dd>
|
|
88 <p>Put quotes around column values in output text file. Possible values: <em>yes or
|
|
89 no</em>. Default value: <em>yes</em>.</p>
|
|
90 </dd>
|
|
91 <dt><strong><strong>-r, --root</strong> <em>rootname</em></strong></dt>
|
|
92 <dd>
|
|
93 <p>New text file name is generated using the root: <Root>.<Ext>. Default new file
|
|
94 name: <InitialTextFileName>SortedByColumn.<Ext>. The csv, and tsv
|
|
95 <Ext> values are used for comma/semicolon, and tab delimited text files
|
|
96 respectively. This option is ignored for multiple input files.</p>
|
|
97 </dd>
|
|
98 <dt><strong><strong>-s, --sort</strong> <em>ascending | descending</em></strong></dt>
|
|
99 <dd>
|
|
100 <p>Sorting order for column values. Possible values: <em>ascending or descending</em>.
|
|
101 Default value: <em>ascending</em>.</p>
|
|
102 </dd>
|
|
103 <dt><strong><strong>-w, --workingdir</strong> <em>dirname</em></strong></dt>
|
|
104 <dd>
|
|
105 <p>Location of working directory. Default: current directory.</p>
|
|
106 </dd>
|
|
107 </dl>
|
|
108 <p>
|
|
109 </p>
|
|
110 <h2>EXAMPLES</h2>
|
|
111 <p>To perform numerical sort in ascending order using first column values and generate
|
|
112 a new CSV text file NewSample1.csv, type:</p>
|
|
113 <div class="ExampleBox">
|
|
114 % SortTextFiles.pl -o -r NewSample1 Sample1.csv</div>
|
|
115 <p>To perform numerical sort in descending order using MolWeight column and generate
|
|
116 a new CSV text file NewSample1.csv, type:</p>
|
|
117 <div class="ExampleBox">
|
|
118 % SortTextFiles.pl -m collabel -k MolWeight --keydata numeric
|
|
119 -s descending -r NewSample1 -o Sample1.csv</div>
|
|
120 <p>To perform numerical sort in ascending order using column number 1 and generate
|
|
121 a new TSV text file NewSample1.csv, type:</p>
|
|
122 <div class="ExampleBox">
|
|
123 % SortTextFiles.pl -m colnum -k 1 --keydata numeric -s ascending
|
|
124 -r NewSample1 --outdelim tab -o Sample1.csv</div>
|
|
125 <p>
|
|
126 </p>
|
|
127 <h2>AUTHOR</h2>
|
|
128 <p><a href="mailto:msud@san.rr.com">Manish Sud</a></p>
|
|
129 <p>
|
|
130 </p>
|
|
131 <h2>SEE ALSO</h2>
|
|
132 <p><a href="./JoinTextFiles.html">JoinTextFiles.pl</a>, <a href="./MergeTextFilesWithSD.html">MergeTextFilesWithSD.pl</a>, <a href="./ModifyTextFilesFormat.html">ModifyTextFilesFormat.pl</a>, <a href="./SplitTextFiles.html">SplitTextFiles.pl</a>, <a href="./TextFilesToHTML.html">TextFilesToHTML.pl</a>
|
|
133 </p>
|
|
134 <p>
|
|
135 </p>
|
|
136 <h2>COPYRIGHT</h2>
|
|
137 <p>Copyright (C) 2015 Manish Sud. All rights reserved.</p>
|
|
138 <p>This file is part of MayaChemTools.</p>
|
|
139 <p>MayaChemTools is free software; you can redistribute it and/or modify it under
|
|
140 the terms of the GNU Lesser General Public License as published by the Free
|
|
141 Software Foundation; either version 3 of the License, or (at your option)
|
|
142 any later version.</p>
|
|
143 <p> </p><p> </p><div class="DocNav">
|
|
144 <table width="100%" border=0 cellpadding=0 cellspacing=2>
|
|
145 <tr align="left" valign="top"><td width="33%" align="left"><a href="./SortSDFiles.html" title="SortSDFiles.html">Previous</a> <a href="./index.html" title="Table of Contents">TOC</a> <a href="./SplitSDFiles.html" title="SplitSDFiles.html">Next</a></td><td width="34%" align="middle"><strong>March 29, 2015</strong></td><td width="33%" align="right"><strong>SortTextFiles.pl</strong></td></tr>
|
|
146 </table>
|
|
147 </div>
|
|
148 <br />
|
|
149 <center>
|
|
150 <img src="../../images/h2o2.png">
|
|
151 </center>
|
|
152 </body>
|
|
153 </html>
|