0
|
1 NAME
|
|
2 SortTextFiles.pl - Sort TextFile(s) using values for a column
|
|
3
|
|
4 SYNOPSIS
|
|
5 SortTextFiles.pl TextFile(s)...
|
|
6
|
|
7 SortTextFiles.pl [-d, --detail infolevel] [-h, --help] [--indelim comma
|
|
8 | semicolon] [-k, --key colnum | collabel] [--keydata numeric |
|
|
9 alphanumeric] [-m, --mode colnum | collabel] [-o, --overwrite]
|
|
10 [--outdelim comma | tab | semicolon] [-q, --quote yes | no] [-r, --root
|
|
11 rootname] [-s, --sort ascending | descending] [-w, --workingdir dirname]
|
|
12 TextFile(s)...
|
|
13
|
|
14 DESCRIPTION
|
|
15 Sort *TextFile(s)* using values for a key column specified by a column
|
|
16 number or label. Only one column key can be specified for sorting. In an
|
|
17 event of conflict during sorting process, two similar values for a
|
|
18 column key are simply transferred to output files in order of their
|
|
19 presence in input files. Additionally, rows with empty or inappropriate
|
|
20 values for column key are simply placed at the end. The file names are
|
|
21 separated by space. The valid file extensions are *.csv* and *.tsv* for
|
|
22 comma/semicolon and tab delimited text files respectively. All other
|
|
23 file names are ignored. All the text files in a current directory can be
|
|
24 specified by **.csv*, **.tsv*, or the current directory name. The
|
|
25 --indelim option determines the format of *TextFile(s)*. Any file which
|
|
26 doesn't correspond to the format indicated by --indelim option is
|
|
27 ignored.
|
|
28
|
|
29 OPTIONS
|
|
30 -d, --detail *infolevel*
|
|
31 Level of information to print about lines being ignored. Default:
|
|
32 *1*. Possible values: *1, 2 or 3*.
|
|
33
|
|
34 -h, --help
|
|
35 Print this help message.
|
|
36
|
|
37 --indelim *comma | semicolon*
|
|
38 Input delimiter for CSV *TextFile(s)*. Possible values: *comma or
|
|
39 semicolon*. Default value: *comma*. For TSV files, this option is
|
|
40 ignored and *tab* is used as a delimiter.
|
|
41
|
|
42 -k, --key *col number | col name*
|
|
43 This value is mode specific. It specifies which column to use for
|
|
44 sorting *TextFile(s)*. Possible values: *col number or col label*.
|
|
45 Default value: *first column*.
|
|
46
|
|
47 --keydata *numeric | alphanumeric*
|
|
48 Data type for column key. Possible values: *numeric or
|
|
49 alphanumeric*. Default value: *numeric*. For *alphanumeric* data
|
|
50 values, comparison is case insensitive.
|
|
51
|
|
52 -m, --mode *colnum | collabel*
|
|
53 Specify how to sort text files: using column number or column label.
|
|
54 Possible values: *colnum or collabel*. Default value: *colnum*.
|
|
55
|
|
56 -o, --overwrite
|
|
57 Overwrite existing files.
|
|
58
|
|
59 --outdelim *comma | tab | semicolon*
|
|
60 Output text file delimiter. Possible values: *comma, tab, or
|
|
61 semicolon* Default value: *comma*.
|
|
62
|
|
63 -q, --quote *yes | no*
|
|
64 Put quotes around column values in output text file. Possible
|
|
65 values: *yes or no*. Default value: *yes*.
|
|
66
|
|
67 -r, --root *rootname*
|
|
68 New text file name is generated using the root: <Root>.<Ext>.
|
|
69 Default new file name: <InitialTextFileName>SortedByColumn.<Ext>.
|
|
70 The csv, and tsv <Ext> values are used for comma/semicolon, and tab
|
|
71 delimited text files respectively. This option is ignored for
|
|
72 multiple input files.
|
|
73
|
|
74 -s, --sort *ascending | descending*
|
|
75 Sorting order for column values. Possible values: *ascending or
|
|
76 descending*. Default value: *ascending*.
|
|
77
|
|
78 -w, --workingdir *dirname*
|
|
79 Location of working directory. Default: current directory.
|
|
80
|
|
81 EXAMPLES
|
|
82 To perform numerical sort in ascending order using first column values
|
|
83 and generate a new CSV text file NewSample1.csv, type:
|
|
84
|
|
85 % SortTextFiles.pl -o -r NewSample1 Sample1.csv
|
|
86
|
|
87 To perform numerical sort in descending order using MolWeight column and
|
|
88 generate a new CSV text file NewSample1.csv, type:
|
|
89
|
|
90 % SortTextFiles.pl -m collabel -k MolWeight --keydata numeric
|
|
91 -s descending -r NewSample1 -o Sample1.csv
|
|
92
|
|
93 To perform numerical sort in ascending order using column number 1 and
|
|
94 generate a new TSV text file NewSample1.csv, type:
|
|
95
|
|
96 % SortTextFiles.pl -m colnum -k 1 --keydata numeric -s ascending
|
|
97 -r NewSample1 --outdelim tab -o Sample1.csv
|
|
98
|
|
99 AUTHOR
|
|
100 Manish Sud <msud@san.rr.com>
|
|
101
|
|
102 SEE ALSO
|
|
103 JoinTextFiles.pl, MergeTextFilesWithSD.pl, ModifyTextFilesFormat.pl,
|
|
104 SplitTextFiles.pl, TextFilesToHTML.pl
|
|
105
|
|
106 COPYRIGHT
|
|
107 Copyright (C) 2015 Manish Sud. All rights reserved.
|
|
108
|
|
109 This file is part of MayaChemTools.
|
|
110
|
|
111 MayaChemTools is free software; you can redistribute it and/or modify it
|
|
112 under the terms of the GNU Lesser General Public License as published by
|
|
113 the Free Software Foundation; either version 3 of the License, or (at
|
|
114 your option) any later version.
|
|
115
|