| File | Date | Author | Commit |
|---|---|---|---|
| src | 2021-06-12 | primalapparatus | [r5] be sure in record mode output file is open befo... |
| COPYING | 2021-06-12 | primalapparatus | [r2] import sources |
| README.md | 2021-06-12 | primalapparatus | [r5] be sure in record mode output file is open befo... |
Split File splits a grouped file into smaller files based on a key.
The file does not have to be sorted (though that is an easy way to make
it grouped for default mode).
In default mode, it just must be grouped so that all the lines with the same
values in the key columns are together. The utility will still work even if it
isn't, but you may get multiple files for the same key that way. There may be
use cases for that scenario, but that is an exercise left to the reader.
Of course, in record mode you don't want to sort it, as it'll naturally
be grouped by the record delimiter.
In default mode, lines with identical strings in the key column range are
written to a single file of their own. They key column range can be selected
by:
In record mode, lines up to, but not including, the record delimiter are
written to a single file. This is pretty simple decision making, and has
a few ramifications, at least:
Output file names are the base name + a sequential number (beginning with 1).
The base name of the generated files can be selected by the user. If a base name
is not provided, the output file names will just be sequential numbers.
Instead of that, the user can have the key be the base name.
The output directory can be provided by the user and does not have to be
the same as the source file directory. The output directory will be
created if it does not exist.
Splitfile will refuse to overwrite an existing output file.
This is pretty simple program with no extra dependencies, so I didn't bother
writing unit tests for it, nor did I bother putting together a make file.
There is a script included called buildandrun.sh, which does just that:
it builds the program and then runs it. For usage information, just run
the command without any arguments.
Split File is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Split File is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Split File. If not, see https://www.gnu.org/licenses/.