我有一个包含foillowing数据的输入文件:
line1
line2
line3
begin
line5
line6
line7
end
line9
line1
line3
我试图找到所有重复的行,我试过
sort filename | uniq -c
但似乎不适合我:
它给了我:
1 begin
1 end
1 line1
1 line1
1 line2
1 line3
1 line3
1 line5
1 line6
1 line7
1 line9
这个问题看似重复,因为Find duplicate lines in a file and count how many time each line was duplicated? 但输入数据的性质不同。
请建议。
答案 0 :(得分:2)
使用它:
sort filename | uniq -d
man uniq