Zz.unkrig.de: Difference between revisions

From unkrig.de
Jump to navigation Jump to search
Line 8: Line 8:


Computes the differences between files, directory trees, archive file entries, compressed files and prints them in various formats; widely compatible with the UNIX™ DIFF command line utility.
Computes the differences between files, directory trees, archive file entries, compressed files and prints them in various formats; widely compatible with the UNIX™ DIFF command line utility.
Download [https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=de.unkrig.zz&a=zz-diff&v=LATEST&c=jar-with-dependencies the runnable JAR file] that includes the command line tool and the ANT task.


Read the [http://zz.unkrig.de/maindoc/zz-diff/Main.main(String%5b%5d).html command line tool documentation].
Read the [http://zz.unkrig.de/maindoc/zz-diff/Main.main(String%5b%5d).html command line tool documentation].
Line 18: Line 16:


Finds files in directory trees and entries in archive files by various criteria; widely compatible with the UNIX™ FIND command line utility.
Finds files in directory trees and entries in archive files by various criteria; widely compatible with the UNIX™ FIND command line utility.
Download [https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=de.unkrig.zz&a=zz-find&v=LATEST&c=jar-with-dependencies the runnable JAR file] that includes the command line tool and the ANT task.


Read the [http://zz.unkrig.de/maindoc/zz-find/Main.main(String%5b%5d).html command line tool documentation].
Read the [http://zz.unkrig.de/maindoc/zz-find/Main.main(String%5b%5d).html command line tool documentation].
Line 28: Line 24:


Finds lines in files in directory trees and in entries in archive files by regular expressions; widely compatible with the UNIX™ GREP command line utility.
Finds lines in files in directory trees and in entries in archive files by regular expressions; widely compatible with the UNIX™ GREP command line utility.
Download [https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=de.unkrig.zz&a=zz-grep&v=LATEST&c=jar-with-dependencies the runnable JAR file] that includes the command line tool and the ANT task.


Read the [http://zz.unkrig.de/maindoc/zz-grep/Main.main(String%5b%5d).html command line tool documentation].
Read the [http://zz.unkrig.de/maindoc/zz-grep/Main.main(String%5b%5d).html command line tool documentation].
Line 38: Line 32:


Creates an archive file from a set of given files, directories, and archive entries.
Creates an archive file from a set of given files, directories, and archive entries.
Download [https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=de.unkrig.zz&a=zz-pack&v=LATEST&c=jar-with-dependencies the runnable JAR file] that includes the command line tool and the ANT task.


Read the [http://zz.unkrig.de/maindoc/zz-pack/Main.main(String%5b%5d).html command line tool documentation].
Read the [http://zz.unkrig.de/maindoc/zz-pack/Main.main(String%5b%5d).html command line tool documentation].
Line 48: Line 40:


Modifies the contents of files in directory trees and of entries in archive files by various criteria; widely compatible with the UNIX™ PATCH command line utility.
Modifies the contents of files in directory trees and of entries in archive files by various criteria; widely compatible with the UNIX™ PATCH command line utility.
Download [https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=de.unkrig.zz&a=zz-patch&v=LATEST&c=jar-with-dependencies the runnable JAR file] that includes the command line tool and the ANT task.


Read the [http://zz.unkrig.de/maindoc/zz-patch/Main.main(String%5b%5d).html command line tool documentation].
Read the [http://zz.unkrig.de/maindoc/zz-patch/Main.main(String%5b%5d).html command line tool documentation].


Read the [http://zz.unkrig.de/antdoc/index.html?tasks/zzpatch.html ANT task documentation].
Read the [http://zz.unkrig.de/antdoc/index.html?tasks/zzpatch.html ANT task documentation].
== Download and Installation ==
=== Runnable JAR files ===
<html>
  <form method="get" action="https://repository.sonatype.org/service/local/artifact/maven/redirect">
    <input type="hidden" name="r" value="central-proxy" />
    <input type="hidden" name="g" value="de.unkrig.zz" />
    <input type="hidden" name="v" value="LATEST" />
    <input type="hidden" name="c" value="jar-with-dependencies" />
    Latest version of
    <select name="a">
      <option>zz-diff</option>
      <option>zz-find</option>
      <option>zz-grep</option>
      <option>zz-pack</option>
      <option>zz-patch</option>
    </select>
    <input type="submit" value="DOWNLOAD" />
  </form>
</html>
=== MS WINDOWS executables ===
<html>
  <form method="get" action="https://repository.sonatype.org/service/local/artifact/maven/redirect">
    <input type="hidden" name="r" value="central-proxy" />
    <input type="hidden" name="g" value="de.unkrig.zz" />
    <input type="hidden" name="v" value="LATEST" />
    <input type="hidden" name="p" value="exe" />
    Latest version of
    <select name="a">
      <option>zz-diff</option>
      <option>zz-find</option>
      <option>zz-grep</option>
      <option>zz-pack</option>
      <option>zz-patch</option>
    </select>
    <input type="submit" value="DOWNLOAD" />
  </form>
</html>
Notice: These executables require an installed JRE; at least version 1.6. They will complain if they cannot find a suitable JRE, and give advice how to get things running.
=== APACHE ANT libraries ===
<html>
  <form method="get" action="https://repository.sonatype.org/service/local/artifact/maven/redirect">
    <input type="hidden" name="r" value="central-proxy" />
    <input type="hidden" name="g" value="de.unkrig.zz" />
    <input type="hidden" name="v" value="LATEST" />
    <input type="hidden" name="c" value="jar-with-dependencies" />
    Latest version of
    <select name="a">
      <option value="zz-all">All-in-one</option>
      <option>zz-diff</option>
      <option>zz-find</option>
      <option>zz-grep</option>
      <option>zz-pack</option>
      <option>zz-patch</option>
    </select>
    <input type="submit" value="DOWNLOAD" />
  </form>
</html>
To use the ANT types, insert one of the following lines in your build script:
  <taskdef resource="de/unkrig/zz/zz-diff.xml"  classpath="path/to/zz-diff-x.y.z-jar-with-dependencies.jar"  />
  <taskdef resource="de/unkrig/zz/zz-find.xml"  classpath="path/to/zz-find-x.y.z-jar-with-dependencies.jar"  />
  <taskdef resource="de/unkrig/zz/zz-grep.xml"  classpath="path/to/zz-grep-x.y.z-jar-with-dependencies.jar"  />
  <taskdef resource="de/unkrig/zz/zz-pack.xml"  classpath="path/to/zz-pack-x.y.z-jar-with-dependencies.jar"  />
  <taskdef resource="de/unkrig/zz/zz-patch.xml" classpath="path/to/zz-patch-x.y.z-jar-with-dependencies.jar" />
If you use more than one of the tools in your build script, it is more efficient to use the "all-in-one" JAR file:
  <taskdef resource="de/unkrig/zz/zz-all.xml" classpath="path/to/zz-all-x.y.z-jar-with-dependencies.jar" />


== API Documentation ==
== API Documentation ==

Revision as of 22:01, 8 November 2016

<meta name="keywords" content="java, compressed, archive, zip, zipped, nested"></meta> <meta name="description" content="A set of command-line tools that handle not only directories and files, but also archive and compressed files, and even nested archive files"></meta> A set of command-line tools that handle not only directories and files, but also archive and compressed files, and even nested archive files. They can even disassemble Java .class files on-the fly and operate on the disassembly.

Tool Documentation

zzdiff

Computes the differences between files, directory trees, archive file entries, compressed files and prints them in various formats; widely compatible with the UNIX™ DIFF command line utility.

Read the command line tool documentation.

Read the ANT task documentation.

zzfind

Finds files in directory trees and entries in archive files by various criteria; widely compatible with the UNIX™ FIND command line utility.

Read the command line tool documentation.

Read the ANT task documentation.

zzgrep

Finds lines in files in directory trees and in entries in archive files by regular expressions; widely compatible with the UNIX™ GREP command line utility.

Read the command line tool documentation.

Read the ANT task documentation.

zzpack

Creates an archive file from a set of given files, directories, and archive entries.

Read the command line tool documentation.

Read the ANT task documentation.

zzpatch

Modifies the contents of files in directory trees and of entries in archive files by various criteria; widely compatible with the UNIX™ PATCH command line utility.

Read the command line tool documentation.

Read the ANT task documentation.

Download and Installation

Runnable JAR files

Latest version of

MS WINDOWS executables

Latest version of

Notice: These executables require an installed JRE; at least version 1.6. They will complain if they cannot find a suitable JRE, and give advice how to get things running.

APACHE ANT libraries

Latest version of

To use the ANT types, insert one of the following lines in your build script:

 <taskdef resource="de/unkrig/zz/zz-diff.xml"  classpath="path/to/zz-diff-x.y.z-jar-with-dependencies.jar"  />
 <taskdef resource="de/unkrig/zz/zz-find.xml"  classpath="path/to/zz-find-x.y.z-jar-with-dependencies.jar"  />
 <taskdef resource="de/unkrig/zz/zz-grep.xml"  classpath="path/to/zz-grep-x.y.z-jar-with-dependencies.jar"  />
 <taskdef resource="de/unkrig/zz/zz-pack.xml"  classpath="path/to/zz-pack-x.y.z-jar-with-dependencies.jar"  />
 <taskdef resource="de/unkrig/zz/zz-patch.xml" classpath="path/to/zz-patch-x.y.z-jar-with-dependencies.jar" />

If you use more than one of the tools in your build script, it is more efficient to use the "all-in-one" JAR file:

 <taskdef resource="de/unkrig/zz/zz-all.xml" classpath="path/to/zz-all-x.y.z-jar-with-dependencies.jar" />

API Documentation

The functionality of the ZZ tools is also available as Java APIs:

Resources

Source code

Binaries

JAVADOC

These tools make heavy use of commons.unkrig.de.

License

ZZ.UNKRIG.DE is published under the "New BSD License".

Change Log

Changes in version 1.3.2-SNAPSHOT (not yet released)
  • -
Changes in version 1.3.1, 2016-11-07
  • The JVM (sometimes) did not terminate when it is shut down orderly (i.e. "main()" returns or "System.exit()" is invoked).
  • Added the "launch4j" maven plugin that creates MS WINDOWS executables from the runnable JAR files.
  • Made the scope of the "ant" dependency "provided", so that the classes of "ant.jar" don't get into the "jar-with-dependencies".
  • Added JAVADOC "overview.html" files for the five zz tools.
  • ZZFIND: Made many methods and nested types PUBLIC, so they can be used via the Java API.
  • Moved ANTDOC generation from "zz-parent/build.ant" to "zz-parent/pom.xml".
  • Added "zz-all", which is an aggregation of the five ZZ tools.
Changes in version 1.3.0, 2016-10-30
  • ZZFIND, <zzfind>: Line separator was missing from the "LS" action.
  • ZZFIND, <zzfind>: Added the "-digest" and "-checksum" actions.
  • ZZFIND: Allow combinations of file names and "-" (STDIN).
  • <zzfind>: Added "<true/>" and "<false/>".
  • ZZFIND: Added "-true" and "-false".
  • <zzfind>: The expression subelements are now named ANT components.
  • ZZFIND: Variable substitution (in "-echo" and "-copy") now supports "@variableName" in addition to "@{variable-name}".
  • ZZDIFF, <zzdiff>: Added options "addedFile" and "deletedFile" which supersede "newFile" and "unidirectionalNewFile".
  • <zzpatch>: File/entry renaming did not work (flag Glob.REPLACEMENT was missing).
  • <zzfind>: Renamed the "<path>" expression component to "<path_>" to avoid a name clash with the global type with the same name.
  • Switched from the old ANT build to MAVEN.
Changes in version 1.2.5, 2016-02-12
  • ZZFIND, <zzfind>: Added the "depth" property.
  • ZZFIND, <zzfind>: Added the "comma operator", "-mtime", "-depth", "-minDepth" and "-maxDepth".
Changes in version 1.2.4, 2016-02-10
  • <zzpatch>: "condition=..." is now an attribute of the <patch> subelement, not the task.
  • zzdiff: Added command line option "--normal".
  • All pathes: Compressed file names and compressed contents paths are now suffixed with '%' (instead of '!') to circumvent problems with "Glob"'s directory prefix mechanism.
  • ZZFIND on STDIN threw exceptions, because "-ls" requires "isDirectory", "size", etc.
  • ZZFIND: Parsing of special command line argument "-" (for "STDIN") didn't work.
  • ZZGREP: The "-quiet" command line option did not have any effect.
Changes in version 1.2.3, 2015-09-27
  • ZZFIND command line tool: Option "--look-into": Glob was compiled WITHOUT the WILDCARD|INCLUDES_EXCLUDES flag.
Changes in version 1.2.2, 2015-09-27
  • ZZPATCH ant task: Removed attribute "memberName=..." from subelement "<add>", because the ant task does not traverse directories (opposed to the command line version), and thus adding members to directories is not possible.
  • ZZDIFF: Fixed some NPEs that occurred when files / entries are EXCLUDED.
  • ZZFIND: Added the "DisassembleAction" (disassembles a Java .class file).
  • Generate and publish HTML documentation for ANT tasks with ANTDOC.
Changes in version 1.2.1, 2015-05-24
  • FIND: Command line tool and ANT task now continue with next directory member on IOExceptions.
  • DIFF: Added the "tokenization" configuration parameter, which allows for Java token-based DIFFing.
  • DIFF: Added the "ignoreCStyleComments" and "ignoreCPlusPlusStyleComments" configuration option (relevant iff "tokenization" is "JAVA").
  • The classes for the 'zzpack' ant task were missing from the jar file.
  • ZZFIND ant task: Added the "file=..." and "dir=..." attributes.
  • ZZFIND: Added the "<echo message=...>" and "<property name=... value=...>" actions.
Changes in version 1.2.0, 2015-04-30
  • "ArchiveFormatFactory" and "CompressionFormatFactory" now register "URLStreamHandler"s for all archive and compression formats, so these can be used as "protocols" of "java.net.URL", e.g. "zip:file:foo.zip!file.txt".
  • Major refactoring of 'de.unkrig.commons.file.fileprocessing' and 'de.unkrig.commons.file.contentsprocessing'. Effectively, ZZGREP can now use these classes, because 'process()' now returns 'T'.
  • Renamed the following classes for consistency with 'java.util.Collections', '...Arrays', etc.:
    • ContentsProcessingUtil => ContentsProcessings
    • ContentsTransformerUtil => ContentsTransformations
    • FileProcessingUtil => FileProcessings
    • FileTransformationUtil => FileTransformations
  • ANT integration: Added the '<patch>' filter (for use in ANT 'filter chain's).
  • ANT integration: Added the 'condition' property to the '<zzpatch>' task.
  • ZZDIFF: Added the "-sequential" command line option.
  • <zzdiff>: Replaced the 'lookInto[Nested](Zip|Gzip)="..."' attributes with the (more flexible) 'lookInto="..."' attribute.
  • <zzdiff>: Replaced the "<exclude>" subelements with the "path=..." attribute, eliminating the unusual "negative" logic.
Changes in version 1.1.0, 2014-10-25
  • zzpatch: No file arguments mean 'transform STDIN to STDOUT'.
  • zzpatch: Added 'conditions' for the 'substitute', 'replace', 'patch', 'remove', 'rename' and 'add' features.
  • zzpatch: Added 'dontSortDirectoryMembers' feature.
  • de.unkrig.commons.file: Thanks to apache.commons.compress, we now not only support the ZIP archive format and the GZIP compression algorithm, but also the AR, ARJ, CPIO, DUMP, JAR, TAR and SEVEN_Z archive formats and the BZIP2, PACK200, XZ, LZMA, SNAPPY and Z compression algorithms.
  • <zzpatch>, <zzgrep>: Removed the 'dir="..."' and 'sortDirectoryMembers="..."' attributes from these ANT tasks because recursing directories is ANT's job.
  • <zzpatch>, <zzgrep>: Replaced the 'lookInto[Nested](Zip|Gzip)="..."' attributes with the (more flexible) 'lookInto="..."' attribute.
  • <zzgrep>: Removed the "dir=..." attribute.
Changes in version 1.0.11, 2014-04-12
  • ZZDIFF: Added option '-unchanged-files' resp. ANT task attribute 'reportUnchangedFiles="true"': Also report unchanged files.
  • ZZDIFF: Added '-zip' and '-nested-zip' command line options - aliases for '-z' and '-zz'.
  • ZZFIND: Added the '-copy' action - similar to '-cat', but copies the data bytewise.
  • <zzfind>: Added a '<sequential>' subelement.
  • <zzgrep>: Added attributes 'file="..."' and 'dir="..."'
  • <zzpatch>: Added attributes 'file="..."', 'tofile="..."', 'dir="..."' and 'todir="..."'
  • de.unkrig.commons.util: <simplelogging>: Added attribute 'spec="..."'.
  • <zzgrep>: Added attribute 'property="..."'.
  • <zzgrep>: Added subelement '<search name="..." regex="..." caseSensitive="..."/>'
  • <zzgrep>: Made the 'case sensitivity logic' POSITIVE.
  • <zzgrep>: Removed the '<include>' and '<exclude>' subelements in favor of 'name="..."'.
  • <zzgrep>: 'name="..."', 'regex="..."' and 'caseSensitive="..."' are now mutually exclusive with '<search>' subelements.
  • <zzgrep>: Runtime optimization: Now only the files to which at least one search applies are processed.
Changes in version 1.0.10, 2014-03-22
  • ZZDIFF: Added option '-keep-going' resp. ANT task attribute 'keepGoing="true"': Report errors and continue with next file.
Changes in version 1.0.9, 2014-03-20
  • COMMONS.UTIL: Added the SIMPLELOGGING task that was missing from 'antlib.xml'.
  • COMMONS.FILE: Inserted lots of logging.
  • ZZPATCH: Added the <regex> and <replacement> subelements to <substitute>: Alternative to the 'regex=...' and 'replacement=...' attributes. The major advantage of the subelements is that they can contain '<![CDATA[...]]>' sections where you don't have to SGML-escape special characters.
  • ZZPATCH: Added lots of logging to make ANT build file debugging easier.
  • ZZPATCH: Contents substitution is no longer line-wise, but allows for multi-line matching and replacement.
  • ZZFIND: Now searching STDIN iff no file specified.
  • ZZDIFF: Added diff mode 'EXIST', which is like diff mode 'QUIET' but ignores CONTENT differences.
Changes in version 1.0.8, 2013-11-29
  • ZZDIFF: Absent file modes COMPARE_*_WITH_EMPTY: Added and deleted directories were counted as difference, although they shouldn't.
Changes in version 1.0.7, 2013-11-26
  • The ZZ tools now live in ONE jar file; there is a new 'Main' class that forks into the various tools
  • Renamed the tasks from 'de.unkrig.zz.diff' to 'zzdiff'.
  • ZZDIFF: Absent file modes COMPARE_ADDED_AND_DELETED_WITH_EMPTY and COMPARE_ADDED_WITH_EMPTY: Added and deleted DIRECTORIES are now treated as EMPTY directories.
  • ZZDIFF: Added ANT task property 'property'.
Changes in version 1.0.6, 2013-10-02
  • ZZPATCH: '-patch' now preserves line separators (instead of silently replacing them with the default line separator).
Changes in version 1.0.5, 2013-10-01
  • ZZDIFF: Added the 'encoding' attribute to the ant task.
  • ZZFIND: Added the missing '<cat>' and '<ls>' actions to the ant task.
  • ZZFIND: Added the '-encoding' option to the command line tool.
  • ZZGREP: Added the 'encoding' attribute to the ant task.
  • ZZGREP: Added the '-encoding' option to the command line tool.
  • ZZPATCH: Added 'inputEncoding' and 'outputEncoding' to 'substitution' and 'patch'.
  • ZZPATCH: Added 'patchFileEncoding' to 'patch'.
  • ZZPATCH: '-substitute' now preserves line separators (instead of silently replacing them with the default line separator).
Changes in version 1.0.4, 2013-09-22
  • ZZFIND: The 'readable', 'writable', 'size' and 'modificationTime' tests were missing from the ANT task
Changes in version 1.0.3, 2013-09-22
  • ZZDIFF: Added the 'absentFileMode' option (a.k.a. as '-new-file' and '-unidirectional-new-file').
  • SimpleLogging: VERBOSE messages were not printed because the OUT_HANDLER was misconfigured.
Changes in version 1.0.2, 2013-07-05
  • Fixed a major bug: 'SelectiveContentsTransfomer' executed BOTH delegates when the predicate evaluates to FALSE. This didn't hurt in many cases, but for 'zzpatch -update' it did.
Changes in version 1.0.1, 2013-06-14
  • Major refactoring of 'de.unkrig.commons'.
Version 1.0.0, 2012-10-03

Initial release.