Sorting unique and duplicates
Sorting is a common task that we can encounter with text files. The
sort command helps us to perform sort operations over text files and
stdin. Most often, it can also be coupled with many other commands to produce the required output.
uniq is another command that is often used along with a
sort command. It helps to extract unique (or duplicate) lines from a text or
stdin. This recipe illustrates most of the use cases with
sort command accepts input as filenames, as well as from
stdin (standard input) and outputs the result by writing into
stdout. The same applies to the
How to do it...
- We can easily sort a given set of files (for example,