Computer Hope

Other Pages

Home
Site map
Computer help

Dictionary
News
Q&A
What's new

Tools

E-mail this page
Print Preview
Edit this page



 

Linux / Unix sort command

Quick links

About sort
Syntax
Examples
Related commands
Unix main page

About sort

Sorts the lines in a text file.

Syntax

sort [-b] [-d] [-f] [-i] [-m] [-M] [-n] [-r] [-u] [+fields] filename [-o outputfile]

-b Ignores spaces at beginning of the line.
-d Uses dictionary sort order and ignores the punctuation.
-f Ignores caps
-i Ignores nonprinting control characters.
-m Merges two or more input files into one sorted output.
-M Treats the first three letters in the line as a month (such as may.)
-n Sorts by the beginning of the number at the beginning of the line.
-r Sorts in reverse order
-u If line is duplicated only display once
+fields Sorts by fields , usually by tabs
filename The name of the file that needs to be sorted.
-o outputfile Sends the sorted output to a file.

Examples

sort -r file.txt - Would sort the file, file.txt in reverse order.

Related commands

comm
join
uniq

 

Index

Category:
Linux / Unix

Companies:
Click here

Related Pages:

 

Resolved

Were you able to locate the answer to your questions?

Home - Computer help - Contact - Dictionary - Links
Link to Computer Hope - Bookmark Computer Hope