Ok, os passos seriam:
-
Para obter o nome do arquivo em arquivo que você deseja ver seu conteúdo, liste o conteúdo (do arquivo zip) com este comando:
unzip -l file.zip
-
Agora, para ver as primeiras
100
linhas:unzip -c file.zip file/name_of_file_of_interest.json | head -100
Nota:
-
Este formato
unzip -c file.zip file/name_of_file_of_interest.json
é necessário, não
unzip -c file.zip name_of_file_of_interest.json
para chegar ao caminho para o arquivo e isso será obtido quando o comando em
step 1
for executado.
Exemplo:
-
Arquivo
unzip -l wordpress-4.7.zip
, produz... 0 2016-12-06 19:40 wordpress/wp-includes/Text/Diff/Renderer/ 5535 2010-02-19 02:25 wordpress/wp-includes/Text/Diff/Renderer/inline.php 6813 2015-06-28 16:27 wordpress/wp-includes/Text/Diff/Renderer.php 12950 2015-06-28 16:27 wordpress/wp-includes/Text/Diff.php 14460 2016-12-02 08:11 wordpress/wp-includes/class-wp-hook.php 34760 2016-12-01 03:19 wordpress/wp-includes/rest-api.php 23621 2016-11-21 03:46 wordpress/wp-includes/update.php 102116 2016-12-04 21:37 wordpress/wp-includes/comment.php 14066 2016-08-25 18:37 wordpress/wp-includes/class-wp-text-diff-renderer-table.php 2853 2015-12-16 10:58 wordpress/wp-config-sample.php
-
Agora quero ver as primeiras
100
linhas do arquivowp-config-sample.php
emwordpress-4.7.zip
, portanto:unzip -p wordpress-4.7.zip wordpress/wp-config-sample.php | head -100
Mais informações:
-
Por que usar a opção
-p
:-p extract files to pipe (stdout). Nothing but the file data is sent to stdout, and the files are always extracted in binary format, just as they are stored (no conversions).
Uma saída mais elagante seria com less
less wordpress-4.7.zip
# OUTPUT
Archive: wordpress-4.7.zip
Length Method Size Cmpr Date Time CRC-32 Name
-------- ------ ------- ---- ---------- ----- -------- ----
0 Stored 0 0% 2016-12-06 19:40 00000000 wordpress/
16250 Defl:X 4157 74% 2016-11-29 06:39 2b3bf692 wordpress/wp-settings.php
3286 Defl:X 1397 58% 2015-05-24 18:26 e732ef29 wordpress/wp-cron.php
1627 Defl:X 799 51% 2016-08-29 13:00 d0339e89 wordpress/wp-comments-post.php
5447 Defl:X 2006 63% 2016-09-27 22:36 888ccd8b wordpress/wp-activate.php
0 Stored 0 0% 2016-12-06 19:40 00000000 wordpress/wp-admin/
2401 Defl:X 933 61% 2016-10-24 05:45 1e03d7a9 wordpress/wp-admin/link-parse-opml.php
0 Stored 0 0% 2016-12-06 19:40 00000000 wordpress/wp-admin/js/
12000 Defl:X 3291 73% 2016-09-13 07:03 77f8b8cb wordpress/wp-admin/js/editor.js
6224 Defl:X 2215 64% 2016-11-03 06:40 693a34f0 wordpress/wp-admin/js/user-profile.min.js
1508 Defl:X 640 58% 2015-07-27 12:19 ee45bde7 wordpress/wp-admin/js/word-count.min.js
5148 Defl:X 2010 61% 2016-11-17 19:28 2384dae7 wordpress/wp-admin/js/tags-suggest.js
6842 Defl:X 2399 65% 2016-10-23 19:16 41742fcd wordpress/wp-admin/js/tags-box.js
17717 Defl:X 5102 71% 2016-07-05 14:37 93dfd6b0 wordpress/wp-admin/js/image-edit.js
34299 Defl:X 7077 79% 2016-11-04 18:18 97b89baa wordpress/wp-admin/js/updates.min.js
4192 Defl:X 1539 63% 2016-06-08 23:37 b8c4c822 wordpress/wp-admin/js/postbox.min.js
20983 Defl:X 6187 71% 2016-11-03 06:40 3aec32c2 wordpress/wp-admin/js/nav-menu.min.js
25330 Defl:X 7009 72% 2016-11-03 06:40 43591b6e wordpress/wp-admin/js/theme.min.js
1502 Defl:X 707 53% 2013-11-14 06:40 4dc0acc0 wordpress/wp-admin/js/custom-header.js
11462 Defl:X 4344 62% 2016-11-03 06:40 0aa95325 wordpress/wp-admin/js/press-this.min.js