Unix and Linux Discussions Tagged with lines |
|
Thread / Thread Starter |
Last Post |
Replies |
Views |
Forum |
|
|
|
7 |
16,408 |
UNIX for Beginners Questions & Answers |
|
|
|
6 |
8,661 |
UNIX for Beginners Questions & Answers |
|
|
|
4 |
12,116 |
UNIX for Beginners Questions & Answers |
|
|
|
5 |
10,596 |
UNIX for Advanced & Expert Users |
|
|
|
1 |
2,531 |
UNIX for Beginners Questions & Answers |
|
|
|
4 |
7,248 |
UNIX for Beginners Questions & Answers |
|
|
|
13 |
7,331 |
UNIX for Beginners Questions & Answers |
|
|
|
2 |
4,775 |
UNIX for Beginners Questions & Answers |
|
|
|
5 |
15,373 |
Shell Programming and Scripting |
|
|
|
5 |
15,390 |
Shell Programming and Scripting |
|
|
|
1 |
2,476 |
UNIX for Beginners Questions & Answers |
|
|
|
7 |
14,392 |
Shell Programming and Scripting |
|
|
|
6 |
2,916 |
UNIX for Beginners Questions & Answers |
|
|
|
2 |
8,088 |
UNIX for Advanced & Expert Users |
|
|
|
2 |
11,105 |
Programming |
|
|
|
2 |
2,069 |
UNIX for Beginners Questions & Answers |
|
|
|
3 |
6,911 |
Shell Programming and Scripting |
|
|
|
1 |
8,754 |
Shell Programming and Scripting |
|
|
|
1 |
7,365 |
UNIX for Beginners Questions & Answers |
|
|
|
4 |
4,949 |
UNIX for Beginners Questions & Answers |
|
|
|
6 |
5,101 |
UNIX for Beginners Questions & Answers |
|
|
|
5 |
4,870 |
UNIX for Beginners Questions & Answers |
|
|
|
2 |
3,383 |
UNIX for Beginners Questions & Answers |
|
|
|
10 |
2,581 |
UNIX for Beginners Questions & Answers |
|
|
|
3 |
4,200 |
UNIX for Beginners Questions & Answers |
|
|
|
3 |
5,130 |
Shell Programming and Scripting |
|
|
|
2 |
3,910 |
Shell Programming and Scripting |
|
|
|
6 |
7,818 |
Shell Programming and Scripting |
|
|
|
1 |
5,101 |
Shell Programming and Scripting |
|
|
|
3 |
6,773 |
Shell Programming and Scripting |
|
|
|
4 |
4,538 |
Shell Programming and Scripting |
|
|
|
5 |
3,562 |
UNIX for Beginners Questions & Answers |
|
|
|
8 |
3,415 |
UNIX for Beginners Questions & Answers |
|
|
|
4 |
1,304 |
UNIX for Beginners Questions & Answers |
|
|
|
4 |
1,691 |
UNIX for Beginners Questions & Answers |
|
|
|
3 |
2,413 |
UNIX for Beginners Questions & Answers |
|
|
|
2 |
1,875 |
UNIX for Beginners Questions & Answers |
|
|
|
18 |
3,745 |
UNIX for Beginners Questions & Answers |
|
|
|
6 |
1,504 |
UNIX for Beginners Questions & Answers |
|
|
|
7 |
6,779 |
UNIX for Beginners Questions & Answers |
uniq(1) General Commands Manual uniq(1)
Name
uniq - report repeated lines in a file
Syntax
uniq [-udc[+n][-n]] [input[output]]
Description
The command reads the input file comparing adjacent lines. In the normal case, the second and succeeding copies of repeated lines are
removed; the remainder is written on the output file. Note that repeated lines must be adjacent in order to be found. For further infor-
mation, see
Options
The n arguments specify skipping an initial portion of each line in the comparison:
-n Skips specified number of fields. A field is defined as a string of non-space, non-tab characters separated by tabs and spaces from its
neighbors.
+n Skips specified number of characters in addition to fields. Fields are skipped before characters.
-c Displays number of repetitions, if any, for each line.
-d Displays only lines that were repeated.
-u Displays only unique (nonrepeated) lines.
If the -u flag is used, just the lines that are not repeated in the original file are output. The -d option specifies that one copy of
just the repeated lines is to be written. The normal mode output is the union of the -u and -d mode outputs.
The -c option supersedes -u and -d and generates an output report in default style but with each line preceded by a count of the number of
times it occurred.
See Also
comm(1), sort(1)
uniq(1)