Use sort.  Use -n for numeric and -t for field separator.   then k for the field.

 

[user1@jibsheet ~]$ ll $HOME/tidal*
-rw-rw-r-- 1 user1 user1 545 Oct 13 10:02 /home/user1/tidal_out.txt
-rw-rw-r-- 1 user1 user1 545 Oct 13 10:02 /home/user1/tidal_out.txt.1
-rw-rw-r-- 1 user1 user1 564 Oct 12 22:39 /home/user1/tidal_out.txt.10
-rw-rw-r-- 1 user1 user1 546 Oct 13 08:02 /home/user1/tidal_out.txt.2
-rw-rw-r-- 1 user1 user1 546 Oct 13 04:02 /home/user1/tidal_out.txt.3
-rw-rw-r-- 1 user1 user1 564 Oct 12 23:02 /home/user1/tidal_out.txt.4
-rw-rw-r-- 1 user1 user1 564 Oct 12 22:41 /home/user1/tidal_out.txt.5
-rw-rw-r-- 1 user1 user1 564 Oct 12 22:40 /home/user1/tidal_out.txt.8
-rw-rw-r-- 1 user1 user1 547 Oct 12 22:40 /home/user1/tidal_out.txt.9
[user1@jibsheet ~]$ ll $HOME/tidal* | sort -t. -k3 -n
-rw-rw-r-- 1 user1 user1 545 Oct 13 10:02 /home/user1/tidal_out.txt
-rw-rw-r-- 1 user1 user1 545 Oct 13 10:02 /home/user1/tidal_out.txt.1
-rw-rw-r-- 1 user1 user1 546 Oct 13 08:02 /home/user1/tidal_out.txt.2
-rw-rw-r-- 1 user1 user1 546 Oct 13 04:02 /home/user1/tidal_out.txt.3
-rw-rw-r-- 1 user1 user1 564 Oct 12 23:02 /home/user1/tidal_out.txt.4
-rw-rw-r-- 1 user1 user1 564 Oct 12 22:41 /home/user1/tidal_out.txt.5
-rw-rw-r-- 1 user1 user1 564 Oct 12 22:40 /home/user1/tidal_out.txt.8
-rw-rw-r-- 1 user1 user1 547 Oct 12 22:40 /home/user1/tidal_out.txt.9
-rw-rw-r-- 1 user1 user1 564 Oct 12 22:39 /home/user1/tidal_out.txt.10

 

 

 

 

Leave a Reply