Difference between two .tar.gz file lists on linux

我怕爱的太早我们不能终老 提交于 2019-12-18 10:35:22

问题


Having two different .tar.gz files: The second .tar.gz is the subset of first .tar.gz.

I need a single line command to find the missing files in second .tar.gz.

E.g.:

1.tar.gz file list:

1.jsp
2.txt
3.htm

2.tar.gz file list:

1.jsp
3.htm

output should be:

2.txt

回答1:


Just list the contents and do diff:

diff <(tar -tvf 1.tar.gz | sort) <(tar -tvf 2.tar.gz | sort)


来源:https://stackoverflow.com/questions/13156383/difference-between-two-tar-gz-file-lists-on-linux

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!