Linux SORT Command

this command will sort the contents of text file line by line in linux.

Syntax

$sort [option] [file_name]

Opetions

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.

Share Share on Facebook Share on Twitter Share on Google+ Share on LinkedIn Pin on Pinterest Share on Stumbleupon Share on Tumblr Share on Reddit Share on Diggit