cdxdoc

How to compare two lines

Many cdx tools need to compare lines of text with each other, for sorting or just equality.

The default behavior is a simple textual match of the whole line - byte for byte.

These tools can take a Comparator of the form --key=Spec where the spec is :

Column,Method,Pattern

where Column is a column name or number. Leave this empty to look at the line as a whole, or for comparators like expr that do not need a separate column specification. Most comparators don’t take a pattern, so you can simplify to simply Column,Method. The default method is plain, so for a plain comparison, you can simplify to Column. An empty string would compare the whole line, plain.

By default, a field that does not represent a valid value for the method sorts higher than any valid value, but by default, all field values are considered valid.

Method is one of :

Combined with :

For example