How to compare two tarball's content

后端 未结 11 820
北海茫月
北海茫月 2021-01-31 15:18

I want to tell whether two tarball files contain identical files, in terms of file name and file content, not including meta-data like date, user, group.

However, There

11条回答
  •  失恋的感觉
    2021-01-31 16:01

    Here is my variant, it is checking the unix permission too:

    Works only if the filenames are shorter than 200 char.

    diff <(tar -tvf 1.tar | awk '{printf "%10s %200s %10s\n",$3,$6,$1}'|sort -k2) <(tar -tvf 2.tar|awk '{printf "%10s %200s %10s\n",$3,$6,$1}'|sort -k2)
    

提交回复
热议问题