If I run svn list svn://repo.example.com/tags
, the listing is:
REL_1.9.0/
REL_1.9.1/
REL_1.9.10/
REL_1.9.11/
REL_1.9.12/
REL_1.9.13/
REL_1.9.14/
REL_1.9.15/
REL_1.9.16/
REL_1.9.2/
REL_1.9.3/
REL_1.9.4/
REL_1.9.5/
REL_1.9.6/
REL_1.9.7/
REL_1.9.8/
REL_1.9.9/
What I would like to get is:
REL_1.9.0/
REL_1.9.1/
REL_1.9.2/
REL_1.9.3/
REL_1.9.4/
REL_1.9.5/
REL_1.9.6/
REL_1.9.7/
REL_1.9.8/
REL_1.9.9/
REL_1.9.10/
REL_1.9.11/
REL_1.9.12/
REL_1.9.13/
REL_1.9.14/
REL_1.9.15/
REL_1.9.16/
So that I can get the most recent tag by tailing like this: svn ... | tail -1
How can I get the tags sorted by creation date, rather than alphabetic order.
Thanks!
The version of sort
I have (cygwin) has this option
-V, --version-sort natural sort of (version) numbers within text
$ cat test.txt | sort -V REL_1.9.0/ REL_1.9.1/ REL_1.9.2/ REL_1.9.3/ REL_1.9.4/ REL_1.9.5/ REL_1.9.6/ REL_1.9.7/ REL_1.9.8/ REL_1.9.9/ REL_1.9.10/ REL_1.9.11/ REL_1.9.12/ REL_1.9.13/ REL_1.9.14/ REL_1.9.15/ REL_1.9.16/
So give svn list ... | sort -V | tail -1
a try
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With