diff options
author | Dylan Cali <calid1984@gmail.com> | 2014-09-05 04:42:02 -0500 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2015-06-19 19:59:21 +0100 |
commit | 71063bc858cd927e3622b511297e66b3e13f7453 (patch) | |
tree | f7574dc51bb55b27881a2d063fb37c76198a4be4 /NEWS | |
parent | 5863426dcfec2336cf0e1a28255e9080889fcb4c (diff) | |
download | coreutils-71063bc858cd927e3622b511297e66b3e13f7453.tar.xz |
numfmt: implement support for field ranges
* src/numfmt.c: Replace field handling code with logic that understands
field range specifiers. Instead of processing a single field and
printing line prefix/suffix around it, process each field in the line
checking whether it has been included for conversion. If so convert and
print, otherwise just print the unaltered field.
(extract_fields): Removed.
(skip_fields): Removed.
(process_line): Gutted and heavily reworked.
(process_suffixed_number): FIELD is now passed as an arg instead of
using a global.
(parse_field_arg): New function that parses field range specifiers.
(next_field): New function that returns pointers to the next field in
a line.
(process_field): New function that wraps the field conversion logic
(include_field): New function that checks whether a field should be
converted
(compare_field): New function used for field value comparisons in a
gl_list.
(free_field): New function used for freeing field values in a gl_list.
Global variable FIELD removed.
New global variable all_fields indicates whether all fields should be
processed.
New global variable all_fields_after stores the first field of a N-
style range.
New global variable all_fields_before stores the last field of a -M
style range.
New global variable field_list stores explicitly specified fields to
process (N N,M or N-M style specifiers).
(usage): Document newly supported field range specifiers.
* bootstrap.conf: Include xlist and linked-list modules. numfmt now
uses the gl_linked_list implementation to store the field ranges.
* tests/misc/numfmt.pl: Add tests for 'cut style' field ranges.
Adjust existing tests as partial output can occur before an error
Remove test for the 'invalid' field -5.. this is now a valid range.
* gnulib: update to avoid compiler warnings in linked-list.
* NEWS: Mention the new feature.
Diffstat (limited to 'NEWS')
-rw-r--r-- | NEWS | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -70,6 +70,8 @@ GNU coreutils NEWS -*- outline -*- dd accepts a new status=progress level to print data transfer statistics on stderr approximately every second. + numfmt can now process multiple fields using field ranges similar to cut. + split accepts a new --separator option to select a record separator character other than the default newline character. |