答案1
我假设您只想获取一条重复的记录,而不需要其余没有重复的记录:
awk -F, 'a[$1]++{print $1}' my_file
例子:
$ cat shasums
804951ce256f190e77baba24f29b6b1890b3e9df ./bell.wav
793e3a485bd29d1e5a87493fa566624d4742f215 ./output.sh
b35bd58dd07d7e3375dea1aee4c5e73e470a928b ./package-lock.json
804951ce256f190e77baba24f29b6b1890b3e9df ./bell.wav
b35bd58dd07d7e3375dea1aee4c5e73e470a928b ./package-lock.json
b35bd58dd07d7e3375dea1aee4c5e73e470a928b ./package-lock.json1
d1847e16de5717f9a35eab98f974c20a867019eb ./shasums
$ awk -F, 'a[$1]++{print $1}' shasums
804951ce256f190e77baba24f29b6b1890b3e9df ./bell.wav
b35bd58dd07d7e3375dea1aee4c5e73e470a928b ./package-lock.json