Jawk 6.4.00
-
Home
- Jawk CLI
CLI Reference
This page documents the CLI surface implemented by Cli[1]. It focuses on the actual parser-backed options in the current codebase rather than historical flags from older Jawk documentation.
Precompiled tuples loaded with -L use Java serialization and are version-sensitive. If Jawk reports that a tuples file is incompatible, recompile it with the current Jawk version instead of trying to reuse the old file.
Invocation Shape
The common command shape is:
java -jar jawk-6.4.00-standalone.jar [options] [script] [name=value | input_filename]...
The extension listing mode is separate:
java -jar jawk-6.4.00-standalone.jar --list-ext
Option Groups
scriptis the inline AWK program used when you do not pass-for-L.-f <filename>reads a script from a file. You can repeat-fto combine multiple script sources.-L <filename>loads previously serializedAwkTuplesinstead of compiling source now.--persist <filename>loads retained user-defined globals from a serialized state file before execution and writes them back after the run finishes.-K <filename>compiles the current script sources to a tuples file and exits without executing the script.
ARGV- Remaining operands after the script are exposed through
ARGVandARGC. - An operand without
=is treated as an input filename. - An operand containing
=is treated as an AWK-style file-list assignment that applies before the next input file is consumed. - Use
-v name=valueinstead when the variable must exist beforeBEGIN.
-v <name=value>assigns a variable before execution begins.-F <fs>sets the initial field separator.-rdisables Jawk's default trapping ofIllegalFormatExceptionforprintfandsprintf.--locale <locale>sets the locale throughLocale.forLanguageTag(...).-tkeeps associative array keys sorted.--posixenforces POSIX-oriented compile-time behavior such as disabling gawk-style nested arrays.JAWK_PERSISTENT_MEMORYcan also point at the persistent-memory file when you do not want to pass--persistexplicitly.--persistwins when both are present.
-l <extension>or--load <extension>loads an extension by registered identifier, simple class name, or fully qualified class name.--list-extprints the identifiers currently registered inExtensionRegistryand exits. It must be used by itself.-Sor--sandboxcompiles and runs the script with sandbox restrictions enabled.
--dump-syntaxprints the parsed abstract syntax tree and skips execution.--dump-intermediateprints the tuple stream and skips execution.-sor--no-optimizedisables tuple optimization during compilation.--profileexecutes the script with runtime profiling enabled and prints tuple and function timing statistics to stderr.--profile=<filename>writes the same profiling report to the specified file instead of stderr.
-hand-?print usage and exit. They must be used by themselves.- Missing option arguments, unknown parameters, invalid
-vsyntax, or missing scripts cause argument parsing to fail. - Jawk reports runtime problems through exceptions and exits with a non-zero status when execution fails.
Execution Notes
--dump-syntax,--dump-intermediate,-K,-h,-?, and--list-extare non-executing modes.--profileis an executing mode. It keeps normal AWK output on stdout and writes the profiling report to stderr after execution finishes.--profile=<filename>keeps normal AWK output on stdout and writes only the profiling report to the file.-Saffects compilation and execution, not just runtime behavior.--posixcurrently disables arrays-of-arrays syntax and related subarray-only operands in order to keep CLI compilation aligned with classic POSIX-style AWK expectations.--posixis rejected together with-L, because loading precompiled tuples bypasses source compilation entirely.-Llets you skip source compilation, but the loaded tuples must still be compatible with the current runtime.-fand-Lare distinct paths: source files compile now, tuple files load now.--persistandJAWK_PERSISTENT_MEMORYaffect only real execution. Non-executing modes such as-K,--dump-syntax, and--dump-intermediateignore persistent memory.
Tuple Serialization Compatibility
Jawk tuples are reusable, but they should be treated as internal artifacts tied to the Jawk version that produced them.
-Kwrites tuples to a file-Lreads those tuples back- version mismatches can cause tuple loading to fail
- the safe fix is to recompile the tuples with the current Jawk version
Persistent memory files use the same Java serialization machinery. They are therefore version-sensitive as well and should be discarded when Jawk reports an incompatibility.
See Also
- [1] apidocs/io/jawk/Cli.html
- [2] cli.html
- [3] java.html
- [4] compatibility.html
