[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
'sort' command -- support more than one field-delimiter
From: |
Dani Moncayo |
Subject: |
'sort' command -- support more than one field-delimiter |
Date: |
Sun, 15 Oct 2023 15:28:24 +0200 |
Consider a file like [1].
(Note that, in each line, the dates are in (month/day/year) format,
_without_ zero-padding)
I want to sort that file by date.
After looking at sort's documentation (and also searching a bit on the
internet), I fail to see a way to achieve that sorting, by just using
the "sort" command.
It seems that one can specify just _one_ character as field separator.
I was expecting to be able to specify more than one. Something like:
$ sort -n -t' /' -k5 -k3 -k4 file1.txt
I think it would give the flexibility I was looking for here.
What do you think?
--
Dani Moncayo
[1]
$ cat file1.txt
SUSE 10.2 12/7/2006
Fedora 10 11/25/2008
SUSE 11.0 6/19/2008
Ubuntu 8.04 4/24/2008
Fedora 8 11/8/2007
SUSE 10.3 10/4/2007
Ubuntu 6.10 10/26/2006
Fedora 7 5/31/2007
Ubuntu 7.10 10/18/2007
Ubuntu 7.04 4/19/2007
SUSE 10.1 5/11/2006
Fedora 6 10/24/2006
Fedora 9 5/13/2008
Ubuntu 6.06 6/1/2006
Ubuntu 8.10 10/30/2008
Fedora 5 3/20/2006
- 'sort' command -- support more than one field-delimiter,
Dani Moncayo <=