A
A
Adian2019-07-16 09:49:22
linux
Adian, 2019-07-16 09:49:22

How to sort a column by time?

Let's say there is a column in a text file with the following times:
10:17
03:56:11
1-02:13:44
8-13:10:00
01:11
15-04:11:02
11:01:51
Like this is it all a matter of sorting (using sort or whatever) from lesser time to greater (digit to dash is days)?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2019-07-16
@shabelski89

if this is just a text file and not the output of the result of some command, then you need to parse the records by giving them seconds and then you can sort them in ascending descending order and return them to the desired form.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question