Computer Science - Unix - Discussion
Discussion Forum : Unix - Section 1 (Q.No. 2)
2.
Which command is used to sort the lines of data in a file in reverse order
Discussion:
4 comments Page 1 of 1.
Jihas K said:
5 years ago
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.
- Reverses sort order(-r).
- Sorting on primary key(-k).
- Numeric sort(-n).
- Removing repeated lines(-u).
These are the sorting options.
Saumik said:
7 years ago
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.
Sujit said:
7 years ago
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
Aparna said:
9 years ago
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).
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).
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers