App-pl

 view release on metacpan or  search on metacpan

pod/examples.pod  view on Meta::CPAN

        } "unzip", "-vqq", $_' *.zip
    pl -oB 'e for @A' 'p {
            k if s@.{29,}% .{16} [\da-f]{8}\K  (.+)@@;
        } "unzip", "-vqq", $_' *.zip

    >   perl-5.30.0.zip
    >   perl-5.30.1.zip
    >   perl-5.30.2.zip
    >   perl-5.30.3.zip
    >   AUTHORS
    >   	   48831  Defl:N    22282  54% 2019-05-11 11:50 cc2a1286
    >   	   48864  Defl:N    22297  54% 2019-10-24 23:27 b793bcc5
    >   	   48927  Defl:N    22338  54% 2020-02-29 12:55 8cecd35e
    >   	   48927  Defl:N    22338  54% 2020-02-11 14:31 8cecd35e
    >   Artistic
    >   	    6321  Defl:N     2400  62% 2019-05-11 11:50 fa53ec29
    >   	    6321  Defl:N     2400  62% 2019-10-24 22:17 fa53ec29
    >   	    6321  Defl:N     2400  62% 2019-10-24 22:17 fa53ec29
    >   	    6321  Defl:N     2400  62% 2019-10-21 13:20 fa53ec29
    >   Changes
    >   	    3168  Defl:N     1273  60% 2018-06-27 13:17 66a9af3e
    >   	    3111  Defl:N     1246  60% 2019-10-27 10:52 f826c349
    >   	    3111  Defl:N     1246  60% 2019-10-27 10:52 f826c349
    >   	    3111  Defl:N     1246  60% 2019-10-28 09:05 f826c349
    >   ...

Java .jar, .ear & .war files (which are aliases for .zip), after a clean build
have many class files with the identical crc, but a different date.  This
excludes the date.  There are examples for L<how to
combine|canned-commands/Shell Functions> these variants as Shell functions:

    pl -o 'piped {
            keydiff $2 if s@.{16} ([\da-f]{8})  (.+)@$1@;
        } "unzip", "-vqq", $_' *.zip
    pl -o 'p {
            k $2 if s@.{16} ([\da-f]{8})  (.+)@$1@;
        } "unzip", "-vqq", $_' *.zip

    >   AUTHORS
    >   	   48831  Defl:N    22282  54% cc2a1286
    >   	   48864  Defl:N    22297  54% b793bcc5
    >   	   48927  Defl:N    22338  54% 8cecd35e
    >   	   48927  Defl:N    22338  54% 8cecd35e
    >   Changes
    >   	    3168  Defl:N     1273  60% 66a9af3e
    >   	    3111  Defl:N     1246  60% f826c349
    >   	    3111  Defl:N     1246  60% f826c349
    >   	    3111  Defl:N     1246  60% f826c349
    >   Configure
    >   	  587687  Defl:N   148890  75% 144c0f25
    >   	  587687  Defl:N   148890  75% 144c0f25
    >   	  587825  Defl:N   148954  75% 6761d877
    >   	  587825  Defl:N   148954  75% 6761d877
    >   INSTALL
    >   	  108059  Defl:N    37351  65% 45af5545
    >   	  108085  Defl:N    37371  65% e5f2f22b
    >   	  107649  Defl:N    37211  65% 9db83c1e
    >   	  107649  Defl:N    37211  65% 16726160
    >   ...

Browsers have a bug of not checking for updated css & javascript.  A common
workaround is to add a hex number to those file names.  In that case use only
the meaningful part of the filename as a key:

    pl -o 'piped {
            keydiff $2
                if s@.{16} ([\da-f]{8})  (.+?)(?:\.([0-9a-f]{20})(\..[a-z]+))?$@if( $3 ) {
                    $n = "$2.\$x$4"; "$1  \$x=$3"
                } else {
                    $n = $2; $1
                }@e
        } "unzip", "-vqq", $_' *.jar
    pl -o 'p {
            k $2
                if s@.{16} ([\da-f]{8})  (.+?)(?:\.([0-9a-f]{20})(\..[a-z]+))?$@if( $3 ) {
                    $n = "$2.\$x$4"; "$1  \$x=$3"
                } else {
                    $n = $2; $1
                }@e
        } "unzip", "-vqq", $_' *.jar

=item Diff Several Tarballs by Member Name

I<Actually I'm very different.  But I rarely find time for it. --B< >von HorvE<0xe1>th :-)>

This is like the zip example.  Alas, tar gives no checksums, so this is less
reliable.  Exclude directories, by taking only lines not starting with a C<d>.
Each time a wider owner/group or file size was seen, columns shift right.  So
reformat the columns, to not show this as a difference:

    pl -oB 'echo for @ARGV' 'piped {
            keydiff $4
                if s!^[^d]\S+ \K(.+?) +(\d+) (.{16}) (.+)!Form "%-20s %10d %s", $1, $2, $3!e;
        } "tar", "-tvf", $_' *.tar *.tgz *.txz
    pl -oB 'e for @A' 'p {
            k $4
                if s!^[^d]\S+ \K(.+?) +(\d+) (.{16}) (.+)!F "%-20s %10d %s", $1, $2, $3!e;
        } "tar", "-tvf", $_' *.tar *.tgz *.txz

    >   perl-5.30.0.txz
    >   perl-5.30.1.txz
    >   perl-5.30.2.txz
    >   perl-5.30.3.txz
    >   ...
    >   cpan/Compress-Raw-Bzip2/bzip2-src/decompress.c
    >   	-r--r--r-- pfeiffer/pfeiffer         20948 2018-06-27 13:17
    >   	-r--r--r-- pfeiffer/pfeiffer         20948 2019-10-24 22:17
    >   	-r--r--r-- pfeiffer/pfeiffer         21287 2020-02-29 12:55
    >   	-r--r--r-- pfeiffer/pfeiffer         21287 2020-02-12 18:41
    >   cpan/Compress-Raw-Bzip2/bzip2-src/huffman.c
    >   	-r--r--r-- pfeiffer/pfeiffer          6991 2018-06-27 13:17
    >   	-r--r--r-- pfeiffer/pfeiffer          6991 2019-10-24 22:17
    >   	-r--r--r-- pfeiffer/pfeiffer          6986 2020-02-29 12:55
    >   	-r--r--r-- pfeiffer/pfeiffer          6986 2020-02-12 18:41
    >   cpan/Compress-Raw-Bzip2/bzip2-src/randtable.c
    >   	-r--r--r-- pfeiffer/pfeiffer          3866 2018-06-27 13:17
    >   	-r--r--r-- pfeiffer/pfeiffer          3866 2019-10-24 22:17
    >   	-r--r--r-- pfeiffer/pfeiffer          3861 2020-02-29 12:55
    >   	-r--r--r-- pfeiffer/pfeiffer          3861 2020-02-12 18:41
    >   cpan/Compress-Raw-Bzip2/fallback/constants.h
    >   	-r--r--r-- pfeiffer/pfeiffer          7238 2018-06-27 13:17



( run in 0.508 second using v1.01-cache-2.11-cpan-d8267643d1d )