Computer Science - Unix - Discussion

Discussion :: Unix - Section 1 (Q.No.2)

2. 

Which command is used to sort the lines of data in a file in reverse order

[A]. sort
[B]. sh
[C]. st
[D]. sort -r
[E]. None of the above

Answer: Option D

Explanation:

No answer description available for this question.

Aparna said: (Jul 31, 2014)  
Sort command is basically used for "ordering a file".
By default, it orders lines in ASCII collating sequence.
Sort options are:

1. Reverses sort order(-r).
2. Sorting on primary key(-k).
3. Numeric sort(-n).
4. Removing repeated lines(-u).

Sujit said: (May 12, 2016)  
It is sort -r, which sorts the file in reverse order. $man sort for more options and you would get to know the meaning of -r

Saumik said: (Aug 25, 2016)  
The sort -r command will first sort then reverse. So, the question is partially wrong. And -k is for sorting with a key reference, not the primary key.

Jihas K said: (Feb 15, 2018)  
Sort command is basically used for "ordering a file".

- Reverses sort order(-r).
- Sorting on primary key(-k).
- Numeric sort(-n).
- Removing repeated lines(-u).

These are the sorting options.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.