which is the correct way to sort file names?
by Skaperen from LinuxQuestions.org on (#5MTS9)
which is the correct way to sort file names? the way ls does it or the way sort does it? here, you can see a difference for some of my recent files:
Code:lt2a/phil /home/phil 97> ls -1 ftrgen*.py
ftrgen1.py
ftrgen2.py
ftrgen3.py
ftrgen4.py
ftrgend.py
ftrgenf.py
ftrgen.py
ftrgenrules.py
ftrgent.py
lt2a/phil /home/phil 98> ls -1 ftrgen*.py|sort
ftrgen.py
ftrgen1.py
ftrgen2.py
ftrgen3.py
ftrgen4.py
ftrgend.py
ftrgenf.py
ftrgenrules.py
ftrgent.py
lt2a/phil /home/phil 99>
Code:lt2a/phil /home/phil 97> ls -1 ftrgen*.py
ftrgen1.py
ftrgen2.py
ftrgen3.py
ftrgen4.py
ftrgend.py
ftrgenf.py
ftrgen.py
ftrgenrules.py
ftrgent.py
lt2a/phil /home/phil 98> ls -1 ftrgen*.py|sort
ftrgen.py
ftrgen1.py
ftrgen2.py
ftrgen3.py
ftrgen4.py
ftrgend.py
ftrgenf.py
ftrgenrules.py
ftrgent.py
lt2a/phil /home/phil 99>