4 ms·
"08-08-2012-20:27:59" Which 08 is the day or the month? cut -d ' ' -f2- foo.log | sort Great, now it's sorted by (month, day, year) or (day, month, year).
by shazow 14y ago
"08-08-2012-20:27:59"
Which 08 is the day or the month?
cut -d ' ' -f2- foo.log | sort
Great, now it's sorted by (month, day, year) or (day, month, year). If my logs span multiple years, the sorting is useless.
Please use YYYY-MM-DD. It's sortable and more intuitive for everyone outside of the USA. See also http://en.wikipedia.org/wiki/ISO_8601 http://en.wikipedia.org/wiki/ISO_8601
- deleted 14y ago[deleted]
- shazow 14y agoI'm not advocating internationalization. I'm advocating for using a well-known formatting standard used by almost every mature library which is unambiguous and useful for sorting.
- trotter_cashion 14y agoMore like the author was lazy and not thinking about correct ordering of the date there. It should absolutely be yyyy-mm-dd. I'll be updating the post w/ feedback from the comments sometime today or tomorrow. So expect to see that change.
- harshreality 14y agoPlease also use a T between date and time parts, per the standard. Making stuff up requires everyone parsing your timestamps to use custom parsing.
- Pfhreak 14y agoStill doesn't solve the sorting problem. YYYY-MM-DD produces sortable strings without needing to parse them.
- deleted 14y ago[deleted]
- zdw 14y agoTo go one step further... RFC3339 gives a more tightly defined subset of ISO8601, which is even more useful and lacking things like "week of year" which have little use on modern systems: http://tools.ietf.org/html/rfc3339 http://tools.ietf.org/html/rfc3339