문제

i have a data.txt file as below

1
1
100
100
1
1
1

when i tried,

more 'data.txt|uniq' 

I get the uniq value of multiple occurrences consecutively

1
100
1

Is there a way, i can get the result as

1
100

Thanks in advance

도움이 되었습니까?

해결책

try executing

$ sort -u data.txt

Description:

according to manpage of uniq

Note: 'uniq' does not detect repeated lines unless they are adjacent. You may want to sort the input first, or use 'sort -u' without 'uniq'.

you can read manpage by executing

$ man uniq

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top