4 ms·
How to validate ISO 8601 dates without regex
- nanis 8y agoWhen your one-liner takes six lines, it is time to open up a text editor and write a decent shell or Perl or Python or whatever script which can be read and understood later. Then, it might turn into 50 lines, but you'll know what it is doing, how it is doing it, and how to modify it if there is a problem or you need an enhancement.
- linuxbob 8y agoAppreciate the comment, but there are only two processes in that command, awk and sort, so it doesn't lend itself to scripting. Compare the regex solution for "date" at https://gist.github.com/philipashlock/8830168 https://gist.github.com/philipashlock/8830168 and you can see why I prefer AWK.