Skip to content

Instantly share code, notes, and snippets.

@blacknon
Last active January 30, 2023 01:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blacknon/5d3b0cf720bc488c3911ee09fdf07592 to your computer and use it in GitHub Desktop.
Save blacknon/5d3b0cf720bc488c3911ee09fdf07592 to your computer and use it in GitHub Desktop.
20170512_zipdiff
s@s:~$ unzip -l test1/test-1.zip
Archive:  test1/test-1.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
       35  2017-05-12 19:05   aaa.txt
        6  2017-05-12 18:55   bbb.txt
        6  2017-05-12 18:56   ccc.txt
---------                     -------
       47                     3 files
s@s:~$ unzip -l test2/test-2.zip
Archive:  test2/test-2.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        6  2017-05-12 18:55   aaa.txt
        6  2017-05-12 18:55   bbb.txt
        6  2017-05-12 18:56   ccc.txt
---------                     -------
       18                     3 files
s@s:~$ echo "unzip -l "{test1/test-1.zip,test2/test-2.zip}"@" | xargs -d@ -n1 sh -c | awk '$1 != 0 && $2 ~ /^[0-9]/ {print $4}' | sort -u | xargs -I@ bash -c 'echo @;diff <(unzip -p test1/test-1.zip @) <(unzip -p test2/test-2.zip @)'
aaa.txt
1,6c1
< ccccc
< ddgsegero
< gfgrfd=	r
<
<
< grdgar
---
> aaaaa
bbb.txt
ccc.txt
s@s:~$ diff -y <(unzip -c test2/test-2.zip) <(unzip -c test1/test-1.zip)
Archive:  test2/test-2.zip				      |	Archive:  test1/test-1.zip
 extracting: aaa.txt                 				 extracting: aaa.txt
aaaaa							      |	ccccc
							      >	ddgsegero
							      >	gfgrfd=	r
							      >
							      >
							      >	grdgar

 extracting: bbb.txt                 				 extracting: bbb.txt
bbbbb								bbbbb

 extracting: ccc.txt                 				 extracting: ccc.txt
ccccc								ccccc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment