我有一个来自重复数据删除工具 (rmlint) 的 csv 文件。我想使用 awk 在给定字段(如校验和)共享相同值的行组之后添加潜水线。
文件:
type,path,size,checksum
emptydir,"/home/user/tree2/b",0,00000000000000000000000000000000
duplicate_dir,"/home/user/test/b",4,f8772f6fda08bbc826543334663d6f13
duplicate_dir,"/home/user/test/a",4,f8772f6fda08bbc826543334663d6f13
duplicate_dir,"/home/user/tree/b",8,62202a79add28a72209b41b6c8f43400
duplicate_dir,"/home/user/tree/a",8,62202a79add28a72209b41b6c8f43400
duplicate_dir,"/home/user/tree2/a",4,311095bc5669453990cd205b647a1a00
期望的输出:
type,path,size,checksum
------------------------
emptydir,"/home/user/tree2/b",0,00000000000000000000000000000000
------------------------
duplicate_dir,"/home/user/test/b",4,f8772f6fda08bbc826543334663d6f13
duplicate_dir,"/home/user/test/a",4,f8772f6fda08bbc826543334663d6f13
------------------------
duplicate_dir,"/home/user/tree/b",8,62202a79add28a72209b41b6c8f43400
duplicate_dir,"/home/user/tree/a",8,62202a79add28a72209b41b6c8f43400
------------------------
duplicate_dir,"/home/user/tree2/a",4,311095bc5669453990cd205b647a1a00
我怎么能用 awk 做这件事呢?