Monday, June 6, 2011

linux: sort

Use the command

sort -n -t. -k4

to sort strings like:
------------------------------
str1.str2.str3.1.txt
str1.str2.str3.10.txt
str1.str2.str3.2.txt
str1.str2.str3.21.txt
------------------------------

Use '-t' to define delimiter, '-n' for number sorting, '-k' for column number

No comments:

Locations of visitors to this page