![]() |
MergeTextFiles.pl - Merge multiple CSV or TSV text files into a single text file
MergeTextFiles.pl TextFiles...
MergeTextFiles.pl [-h, --help] [--indelim comma | semicolon] [-c, --columns colnum,...;... | collabel,...;...] [-k, --keys colnum,...;... | collabel,...;...] [-m, --mode colnum | collabel] [-o, --overwrite] [--outdelim comma | tab | semicolon] [-q, --quote yes | no] [-r, --root rootname] [-s, --startcol colnum | collabel] [--startcolmode before | after] [-w, --workingdir dirname] TextFiles...
Merge multiple CSV or TSV TextFiles into first TextFile to generate a single text file. Unless -k --keys option is used, data rows from other TextFiles are added to first TextFile in a sequential order, and the number of rows in first TextFile is used to determine how many rows of data are added from other TextFiles.
Multiple TextFiles names are separated by space. The valid file extensions are .csv and .tsv for comma/semicolon and tab delimited text files respectively. All other file names are ignored. All the text files in a current directory can be specified by *.csv, *.tsv, or the current directory name. The --indelim option determines the format of TextFiles. Any file which doesn't correspond to the format indicated by --indelim option is ignored.
Default value: all;all;.... By default, all columns from specified text files are merged into first text file.
For colnum mode, input value format is: colnum,...;colnum,...;.... Example:
For collabel mode, input value format is: collabel,...;collabel,...;.... Example:
By default, data rows from text files are merged into first file in the order they appear.
For colnum mode, input value format is:colkeynum, colkeynum;.... Example:
For collabel mode, input value format is:colkeylabel, colkeylabel;.... Example:
Default value: last. Start merge after the last column.
To merge Sample2.csv and Sample3.csv into Sample1.csv and generate NewSample.csv, type:
To merge all Sample*.tsv and generate NewSample.tsv file, type:
To merge column numbers ''1,2'' and ''3,4,5'' from Sample2.csv and Sample3.csv into Sample1.csv starting before column number 3 in Sample1.csv and to generate NewSample.csv without quoting column data, type:
To merge column ''Mol_ID,Formula,MolWeight'' and ''Mol_ID,NAME,ChemBankID'' from Sample2.csv and Sample3.csv into Sample1.csv using ''Mol_ID'' as a column keys starting after the last column and to generate NewSample.tsv, type:
JoinTextFiles.pl, MergeTextFilesWithSD.pl, ModifyTextFilesFormat.pl, SplitTextFiles.pl
Copyright (C) 2004-2008 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.