sorting lines by date
David V Glasgow
dvglasgow at gmail.com
Fri Jul 10 18:06:05 EDT 2020
Livecodeistas,
I am working with text files consisting of many thousands of lines, most of which are in the format URL & Tab & Date - but a few don’t have a date.
So they look like this ...
http://1.lw6.blah/b7f3bd9e6b4d728a0f6d5883ed3a5ce/5326d47f?ss=152 17/03/2014 9:55
http://1.lw6.zdomain/storage/1/x/xk/xkwEp/encoded.mp4/7aecf5e57e34c5f9212f30d0ca16da5a/5326d454?ss=107
http://1.lw6.zdomain/storage/1/x/xk/xkwEp/encoded.mp4/7aecf5e57e34c5f9212f30d0ca16da5a/5326d454?ss=107
http://1.lw6.zdomain/storage/1/x/xk/xkwEp/encoded.mp4/7aecf5e57e34c5f9212f30d0ca16da5a/5326d454?ss=107
http://adomain/ 27/06/2016 8:10
http://adomain/ 27/06/2016 8:10
http://adomain/ 27/06/2016 8:10
http://adomain/ 27/06/2016 8:10
http://adomain/?go=click&c=133&n=1&e=0&g=3&r=3841375&u=http%253A%252F%252Fadomain%somestuff-330835.html 17/11/2013 22:18
http://adomain/?go=click&c=133&n=1&e=0&g=3&r=3841375&u=http%253A%252F%252Fadomain%somestuff-330835.html 17/11/2013 22:18
http://adomain/?go=click&c=133&n=1&e=0&g=3&r=3841375&u=http%253A%252F%252Fadomain%somestuff-330835.html 17/11/2013 22:18
http://adomain/?go=click&c=133&n=1&e=0&g=3&r=3841375&u=http%253A%252F%252Fadomain%somestuff-330835.html 17/11/2013 22:18
http://adomain/?go=click&c=133&n=1&e=0&g=3&r=3841375&u=http%253A%252F%252Fadomain%somestuff-330835.html 17/11/2013 22:18
I assumed I could sort the lines by date using the following:
set itemdel to tab
sort lines of field "import" datetime by the last item of each
(I know I could speed this up using a variable, but I wanted to just see the result first.)
I wasn’t sure what would happen to the lines with no date, but assumed they would pile up at the beginning or the end of the field (which would be fine). However, what happens is that the script runs, and the order above is generated. I can’t see any meaningful ordering of the lines.
I have a horrible feeling that dates are more complicated than I imagined, although I am sort of hoping there something simple I just haven’t grasped. If so, what?
Best wishes,
David Glasgow
More information about the use-livecode
mailing list