VNL-SORT(1) | vnlog | VNL-SORT(1) |
vnl-sort - sorts an vnlog file, preserving the legend
$ cat a.vnl # a b AA 11 bb 12 CC 13 dd 14 dd 123 Sort lexically by a: $ <a.vnl vnl-sort -k a # a b AA 11 CC 13 bb 12 dd 123 dd 14 Sort lexically by a, ignoring case: $ <a.vnl vnl-sort -k a --ignore-case # a b AA 11 bb 12 CC 13 dd 123 dd 14 Sort lexically by a, then numerically by b: $ <a.vnl vnl-sort -k a -k b.n # a b AA 11 CC 13 bb 12 dd 14 dd 123 Sort lexically by a, then numerically by b in reverse: $ <a.vnl vnl-sort -k a -k b.nr # a b AA 11 CC 13 bb 12 dd 123 dd 14 Sort by month and then day: $ cat dat.vnl # month day March 5 Jan 2 Feb 1 March 30 Jan 21 $ <dat.vnl vnl-sort -k month.M -k day.n # month day Jan 2 Jan 21 Feb 1 March 5 March 30
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
sort -k1
to sort by the first column, you say
sort -k time
to sort by column "time".
vnl-sort -k month.M -k day.n
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.
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.
https://github.com/dkogan/vnlog/
Dima Kogan "<dima@secretsauce.net>"
Copyright 2018 Dima Kogan "<dima@secretsauce.net>"
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.
2020-12-09 |