سؤال

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