Jawk: AWK for Java

Overview

Jawk is a pure Java implementation of AWK[1]. You can run AWK programs in a JVM application and integrate with your Java code:

CLI

CLI

$ echo "hello world" | java -jar jawk-6.4.00-standalone.jar '{ print $2 ", " $1 "!" }'
world, hello!
Java

Java

Awk awk = new Awk();
String result = awk.script("{ print toupper($0) }").input("hello world").execute();
// result = "HELLO WORLD\n"

Compatibility and Compliance

POSIX
100%
One True Awk
97%
gawk
24%

The above scores are calculated from the latest compatibility tests during mvn verify site. See the full compatibility dashboard[2] for per-suite maps and the Failsafe report[3] for detailed test results.

Key Capabilities

  • CLI-compatible AWK execution with inline scripts, script files, operands, and input files
  • Java entry points for script execution, expression evaluation, tuple compilation, and repeated reuse
  • Structured input through InputSource for row-oriented or already-tokenized data
  • Explicit extension loading through the Java API or the CLI
  • Tuple serialization for CLI precompilation and later loading
  • Sandbox-specific tuples and runtime components through SandboxedAwk

Differences with Traditional AWK

Jawk aims to be a practical AWK implementation for JVM environments, but it is not a byte-for-byte clone of every historical AWK behavior. Some differences are deliberate and come from the way Jawk integrates with Java:

  • Regular expression behavior follows Java's regex engine, which may differ from traditional AWK regexes in edge cases.
  • printf() and sprintf() try to replicate C-style formatting but may have differences due to Java's formatting capabilities and limitations.
  • Some floating-point edge cases may differ due to Java's handling of floating-point arithmetic and representation.
  • Jawk resolves user-defined function calls during compilation. It does not defer all of that work to runtime.

History of Jawk

Date Event
2006-⁠02-⁠26 Initial release of Jawk 0.1 on SourceForge[4] by Danny Daglas[5], the original author of this project.
2008-⁠01-⁠18 Last release of Jawk 1.02 on SourceForge, corresponding to the official (now defunct) Jawk website[6].
2012-⁠07-⁠18 Fork on GitHub[7] by hoijui[8] (a.k.a. Robin Vodruba), with the first commit being a copy of the original Jawk 1.02 source code + Maven.
2018-⁠02-⁠06 Bertrand Martin begins maintaining a private fork at Sentry Software[9] with a first private release of Jawk 1.03.
2023-⁠07-⁠20 Bertrand's fork is finally made public on Sentry Software's GitHub repository. Jawk is in version 2.1.xx.
2023-⁠12-⁠14 Jawk 3.0.00 is released on Maven Central[10] under org.sentrysoftware.jawk.
2025-⁠02-⁠13 Version 3.3.04[11] is the last version of Jawk released by Sentry Software. MetricsHub[12] takes over the project.
2025-⁠11-⁠04 MetricsHub releases Jawk 5.0.00[13] on Maven Central.
2026-⁠03-⁠26 Bertrand Martin moves Jawk to an independent jawkio/jawk GitHub repository[14], dedicated to Jawk only.
2026-⁠04-⁠16 Version 6.0.00 of Jawk is released on Maven Central[15] under io.jawk. The project is now hosted at jawk.io[16].

Next Steps

jawk awk java cli text processing awk
Links:
  • [1] https://en.wikipedia.org/wiki/AWK
  • [2] compatibility.html
  • [3] failsafe.html
  • [4] https://sourceforge.net/projects/jawk/files/jawk/0.1/
  • [5] https://sourceforge.net/u/ddaglas/profile/
  • [6] https://web.archive.org/web/20260209081949/https://jawk.sourceforge.net/
  • [7] https://github.com/hoijui/Jawk
  • [8] https://github.com/hoijui
  • [9] https://www.sentrysoftware.com/
  • [10] https://central.sonatype.com/artifact/org.sentrysoftware/jawk/3.0.00
  • [11] https://central.sonatype.com/artifact/org.sentrysoftware/jawk/3.3.04
  • [12] https://metricshub.com
  • [13] https://central.sonatype.com/artifact/org.metricshub/jawk/5.0.00
  • [14] https://github.com/jawkio/jawk
  • [15] https://central.sonatype.com/artifact/io.jawk/jawk/6.0.00
  • [16] https://jawk.io
  • [17] install.html
  • [18] java.html
  • [19] cli.html
  • [20] java-variables.html
  • [21] java-input.html
  • [22] java-compile.html
  • [23] extensions.html
Searching...
No results.