Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have written a bash script that I need to work identically on linux and mac osx that relies on the sort command. I am piping the output of git tag -l to sort to get a list of all the version tags in the correct semantic order. GNU offers -V which makes this automagic but mac osx does not support this argument so i need to figure out how to accomplish this sort order without it.

6.3.1.1
6.3.1.10
6.3.1.11
6.3.1.2
6.3.1.3
...

needs to be sorted as

6.3.1.1
6.3.1.2
6.3.1.3
...
6.3.1.10
6.3.1.11
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.2k views
Welcome To Ask or Share your Answers For Others

1 Answer

You can download coreUtils from http://rudix.org/packages/index.html . It contains "gnusort" with support "sort -V" sintax


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...