4.4 Delete duplications of line (uniq) |
Format |
uniq file-name |
If there is the same content as the previous line, the line is not output. You can group consecutive lines of the same content into one line.
Practice: Create a file for the uniq command confirmation |
It assumes that there is a file named uniq-sample as follows.
$ cat > uniq-sample ↵ |
Practice: Execution of uniq command |
$ uniq uniq-sample ↵ |
By executing uniq, duplicates of CCC are organized into one line. There are two rows of AAA, but the
result is output as it is. This is because AAA lines are not consecutive, so they were not processed by uniq.