![]() This option is to print only unique lines in file. For example, line “aa” was there twice in the test file, so the following uniq command displayed the line “aa” twice in this output.īb 4. But, this -D option will print all duplicate lines in file. The above example displayed all the duplicate lines, but only once. As you see below, this didn’t display the line “xx”, as it is not duplicate in the test file. ![]() This option is to print only duplicate repeated lines in file. Print only Duplicate Lines using -d option ![]() This option is to count occurrence of lines in file. Count Number of Occurrences using -c option $ cat testįor example, when uniq command is run without any option, it removes duplicate lines and displays unique lines as shown below. The following test file is used in some of the example to understand how uniq command works. This tutorial explains few most frequently used uniq command line options that you might find helpful. Uniq command is helpful to remove or detect duplicate entries in a file.
0 Comments
Leave a Reply. |