logfold

Usage

Command-line reference for logfold 0.9.4.

logfold [-n] [-m N] [-c] [FILE ...]

With no FILE, logfold reads standard input. With several files they are read one after another as a single stream, so a run can continue across a file boundary.

Options

OptionMeaning
-n, --normalizeMask timestamps, hex values and numbers before comparing lines. The line that is printed is the original, unmasked one.
-m N, --min NFold only runs of at least N lines. Shorter runs are printed as they are. Default 2; values below 2 are rejected.
-c, --count-firstPrint the count before the line, right-aligned, instead of (xN) after it. Easier to sort.
-V, --versionPrint the version and exit.
-h, --helpPrint a short help text and exit.

What counts as the same line

Lines are compared exactly, except for the trailing newline. Without -n a single changed digit starts a new run. With -n the following parts are replaced before comparing, in this order:

PatternReplaced by
ISO 8601 date and time, with optional fraction and zone<ts>
Clock time such as 10:00:01.250<time>
Hexadecimal numbers with a 0x prefix<hex>
Whole decimal numbers<n>

Only consecutive lines fold. If a line comes back after something else, it starts a new run; logfold never reorders or drops lines.

Exit status

CodeMeaning
0Input was read and written. A closed pipe, as with | head, is not an error.
1A file could not be read. The message goes to standard error.
2Invalid command line.

Encoding

Input is read as UTF-8. Bytes that are not valid UTF-8 are replaced rather than rejected, because log files are rarely clean.