dateutils
dateutils copied to clipboard
dateconv -E seems incompatible with -S
The intention is to use dateconv -S to convert strings which match but exclude lines which do not.
E.g. Currently:
% printf '%s\n' '01-03-2004 foo' 'bar baz' | dateconv -Si %d-%m-%Y -f %F
2004-03-01 foo bar
bar baz
% printf '%s\n' '01-03-2004 foo' 'bar baz' | dateconv -ESi %d-%m-%Y -f %F
Where I'd like or expect:
% printf '%s\n' '01-03-2004 foo' 'bar baz' | dateconv -ESi %d-%m-%Y -f %F
2004-03-01 foo bar
Or, ideally:
% printf '%s\n' '01-03-2004 foo' 'bar baz' | dateconv -ESi %d-%m-%Y -f %F
2004-03-01 foo bar
This is related to https://github.com/hroptatyr/dateutils/issues/138 insofar as I would like to exclude failures from my data set.
Hi, thanks for the report. This was indeed an oversight. 49e5bc18e contains a proposal. I would like to keep -E's behaviour to print empty lines so that the result before and after the pipe show the same line count.
What benefit would matching line counts have? Perhaps this is useful for someone, but as far as I can see this means sticking | awk NF after every use of it.
To find out about lines that couldn't be converted. Otherwise, plug a dategrep beforehand to find lines with a given formatting first. If dateconv also did filtering then there would be no way to find out without more tools (nl, diff, etc.)
That's a fair point even though it's not something I typically need as I tend to use pipelines as sieves. I can always regain this feature, but the loss of information could not be recovered.