this command will sort the contents of text file line by line in linux.
$sort [option] [file_name]
Sr.No |
Options |
Descriptions |
---|---|---|
01 |
-r |
reverse the result of comparison.(Descending order) |
02 |
-u |
for unique line |
03 |
-f |
fold the case lower to upper charaters |
04 |
-m |
merge the contents of sorted files. |
05 |
-M |
compare month and sort the month name of file.(JAN |
Example
$sort file1.txt
it will sort the contents of file1.txt in ascending order
$sort file1.txt file2.txt
it will display the contents of file1.txt,file2.txt(multiple files) in ascending order.