-
Notifications
You must be signed in to change notification settings - Fork 2
Missing uniq command #29
Copy link
Copy link
Open
Labels
Description
We need a uniq command, but how it should behave?
@katcipis @geyslan @cadicallegari
Differently from Plan9 and GNU uniq, it should apply the uniq in the entire input buffer, not only in the adjacent input lines. The current @geyslan implementations already did this way (#27 #28).
Below are some test cases I do expect to work:
$ cat > file.txt
1
1
1
2
1
3
3
1
# by default, print every string one time (output have unique entries).
# empty lines are ignored
$ cat file.txt | uniq
1
2
3
# -dup print only lines that are duplicated in the input
$ cat file.txt | uniq -dup
1
3
# -empty print empty lines also
$ cat file.txt | uniq -empty
1
2
3
$ A third option to show line numbers could be added if it do not complicates the tool.
@geyslan Current implementation do not honor this cases. I know it's not like 'gnu uniq'. But what do you think? Makes sense?
Reactions are currently unavailable