How to find the particular text stored in the file “data.txt” and it occurs only once

前端 未结 8 1619
暗喜
暗喜 2021-01-11 17:37

The line I seek is stored in the file data.txt and is the only line of text that occurs only once.

How do I go about finding that particular line using linux?

相关标签:
8条回答
  • 2021-01-11 18:32

    This is a little bit old, but I think you are looking for this...

    cat data.txt | sort | uniq -u
    

    This will show the unique values that only occur once in the file. I assume you are familiar with "over the wire" if you are asking?? If so, this is what you are looking for.

    0 讨论(0)
  • 2021-01-11 18:33

    sort data.txt | uniq -c | grep 1

    you will find only one that accures one time

    0 讨论(0)
提交回复
热议问题