|
a command line
free external tools,
java sources
cpp sources
articles
|
Download the tool here:
The current version is 1.5.6 Revision 3, fixing startup error messages. Type "zzfind" on the command line to get the following help text.
usage:
zzfind [opts] zipname word1 [word2] [word3] ...
zzfind [opts] -pat word1 [...] -dir zip1 [[!]*path] -file [!].ext1
searches in .zip .jar .ear .war or .aar files, and in zip files
embedded within other zip files, for words.
if multiple words are given, then only areas containing ALL words
are listed. the search is case insensitive by default.
zzfind autodetects if a file content is text or binary. with binary,
the distance between words must be <80 chars to be listed as a hit.
file and search pattern syntax
1. short form, easy but not very flexible:
singlezipname word1 [word2 word3 ...]
searches a single zip file for words.
2. long form, more to type but very flexible:
-pat word1 [...] -dir zip1 [zip2] [[!]*pathmask] -file fm1 [fm2]
searches any number of zip files for patterns (words), but only
- within subfiles having file mask fm1 or fm2 in their name
- within subfiles having (not) pathmask in their path.
"subfile" means a file within a zip file. a path mask is defined
as a word with a wildcard "*" listed in the -dir section.
path masks and file masks can be negated by !, for example,
"-file !.bak" means "all files except .bak files".
to learn all about the file selection syntax, it is recommended to
download the free Swiss File Knife Base and type "sfk help select".
options
-text process only text files, skip all binary files.
finds words also over long lines, avoiding line breaks.
-bin do not autodetect file content, process all as binary.
can also be used for floating text files (one linefeed per
paragraph, not per line). may produce unwanted line breaks
with short-lined text.
-case or -c activates case-sensitive search (not default).
-lnum list line numbers of hits.
-nocol disable color highlighting of output.
-names list only names of files containing at least one hit.
-count list no. of matching lines per file. implies -names.
requires -text option, cannot be used with binary files.
-quiet do not show "scan" progress info.
-pure do not list filenames, list only text hits without indent.
default when specifying a single file as first parameter.
-verbose tells in detail what find is actually searching for.
pattern support:
no wildcards or slash patterns are supported, with one exception:
if you need to find patterns starting with "-" or "+", prefix
them with backslash \ to avoid misinterpretation as options.
return codes for batch files
0 = no matches, 1 = matches found, >1 = error occurred.
examples
zzfind myzip.zip foo bar include
search all files within myzip for the words foo+bar+include.
zzfind -text myzip.zip foo bar include
the same, but search only in text files, skipping binaries.
zzfind -pat "class " -dir source.zip -file .h
search all .h files within source.zip for pattern "class ".
zzfind -pat "class " -dir x.zip *\include
search for pattern "class " in all include directories of x.zip.
note that the "*" marks \include as a path mask.
zzfind -pat foosys -dir foo.zip bar.zip !*\depr -file .java
within files foo.zip and bar.zip, search for the word "foosys",
but only within .java file contents that are NOT located within
a path starting with "depr" (e.g. \deprecated\).
see also: listing all .jar contents
to get a list of all classes of all .jar files in a directory tree,
it might be sufficient to list the .jar file contents, instead of
actually searching them. get the free Swiss File Knife and type:
sfk -arc list mydir .jar
this lists the contents of all .jar's within mydir,
including nested .jar's within those jar's, if any.
|
|