Sort Assignment Help

Assignment Help: >> Filters - Sort

sort

sort is a filter utility which is used to order the contents of the denoted file, alphabetically and show the result of the sort at the terminal. The real contents of the file remain not changed.

Syntax

sort [options] filename

Options can be

-n         Sorts the input numerically

-r          Sorts the input in reverse order

-f         Ignores the significance of lowercase and uppercase letters

-o         Sends the output to a file other than the standard output

-k         Sorts the records fieldwise

-t SEP    Uses Separator alter of non- to whitespace transition

Practice 1

The following displays the usage of the sort command.

# cat students

Rama

Anju

Anita

Sanjana

Hema

Jeevan

Bobby

Neha

Priya

# sort students

Anita

Anju

Bobby

Hema

Jeevan

Neha

Priya

Rama

Sanjana

In the given example there is a file students which holds the names of the students of a particular batch. In sequence to show the names in an alphabetical order, a sort command is used. A sort command orders the names alphabetically.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd