How to delete duplicate lines in a file without sorting it in Unix?

后端 未结 9 1518
Happy的楠姐
Happy的楠姐 2020-11-22 17:26

Is there a way to delete duplicate lines in a file in Unix?

I can do it with sort -u and uniq commands, but I want to use sed

9条回答
  •  失恋的感觉
    2020-11-22 17:56

    cat filename | sort | uniq -c | awk -F" " '$1<2 {print $2}'
    

    Deletes the duplicate lines using awk.

提交回复
热议问题