arielf / cuts

Unix 'cut' (and 'paste') on steroids: more flexible select columns from files
Artistic License 2.0
66 stars 7 forks source link

column ranges going from positive to negative (from end) - should be straight #3

Open arielf opened 10 years ago

arielf commented 10 years ago

Currently, these ranges (e.g. 2--1) are implemented as wrap-arounds (going right to left) because they are interpreted as 'reverse order' ranges.

It would be nicer if we could support a straight (left to right) expansion of them.

The problem is that the number of fields is not known till actually reading each line, so expand_list() should be lazily delayed till parse time, and on each line which is incompatible with the current implementation.

This is the only case out of 4 which is not 'natural'. the other 3 cases: positive-positive, negative-negative, and negative-positive are all implemented as might be reasonably and optimally expected by the user.