NAME
vnl-sort - sorts an vnlog file, preserving the legend
SYNOPSIS
$ cat a.vnl# a bAA 11bb 12CC 13dd 14dd 123Sort lexically by a:$ <a.vnl vnl-sort -k a# a bAA 11CC 13bb 12dd 123dd 14Sort lexically by a, ignoring case:$ <a.vnl vnl-sort -k a --ignore-case# a bAA 11bb 12CC 13dd 123dd 14Sort lexically by a, then numerically by b:$ <a.vnl vnl-sort -k a -k b.n# a bAA 11CC 13bb 12dd 14dd 123Sort lexically by a, then numerically by b in reverse:$ <a.vnl vnl-sort -k a -k b.nr# a bAA 11CC 13bb 12dd 123dd 14Sort by month and then day:$ cat dat.vnl# month dayMarch 5Jan 2Feb 1March 30Jan 21$ <dat.vnl vnl-sort -k month.M -k day.n# month dayJan 2Jan 21Feb 1March 5March 30
DESCRIPTION
Usage: vnl-sort [options] logfile logfile logfile ... < logfile
This tool sorts given vnlog files in various ways. "vnl-sort" is a wrapper around the GNU coreutils "sort" tool. Since this is a wrapper, most commandline options and behaviors of the "sort" tool are present; consult the sort(1) manpage for detail. The differences from GNU coreutils "sort" are
- •
-
The input and output to this tool are vnlog files, complete with a legend
- •
-
The columns are referenced by name, not index. So instead of saying
sort -k1to sort by the first column, you say
sort -k timeto sort by column "time".
- •
-
The fancy
"KEYDEF"spec from"sort"is only partially supported. I only allow us to sort by full fields, so the start/stop positions don't make sense. I do support the"OPTS"to change the type of sorting in a given particular column. For instance, to sort by month and then by day, do this (see example above):vnl-sort -k month.M -k day.n
- •
-
"--files0-from"is not supported due to lack of time. If somebody really needs it, talk to me.
- •
-
"--output"is not supported due to an uninteresting technical limitation. The output always goes to standard out.
- •
-
"--field-separator"is not supported because vnlog assumes whitespace-separated fields
- •
-
"--zero-terminated"is not supported because vnlog assumes newline-separated records
- •
-
By default we call the
"sort"tool to do the actual work. If the underlying tool has a different name or lives in an odd path, this can be specified by passing"--vnl-tool TOOL"
Past that, everything "sort" does is supported, so see that man page for detailed documentation. Note that all non-legend comments are stripped out, since it's not obvious where they should end up.
COMPATIBILITY
I use GNU/Linux-based systems exclusively, but everything has been tested functional on FreeBSD and OSX in addition to Debian, Ubuntu and CentOS. I can imagine there's something I missed when testing on non-Linux systems, so please let me know if you find any issues.
SEE ALSO
REPOSITORY
https://github.com/dkogan/vnlog/
AUTHOR
Dima Kogan "<[email protected]>"
LICENSE AND COPYRIGHT
Copyright 2018 Dima Kogan "<[email protected]>"
This library 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 2.1 of the License, or (at your option) any later version.