Text ProcessingLesson 21Free preview
Bash Sort Lines (sort)
This lesson is part of Bash · All levels
Summary
The sort commands sort the lines of text, in a sequence of letters. The -n option is required to order numbers numerically, -r reverses the result, and -u removes the twin row. It's almost always combined with the pipe to refine the output of other commands.
Key points
- Sort file sorting the lines alphabetically
- n sort as numbers, not text
- R reverses the order, -u deletes the duplicate
- k and -t sort by column
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.