Lokad.Awk 0.4.0

Prefix Reserved
dotnet add package Lokad.Awk --version 0.4.0
                    
NuGet\Install-Package Lokad.Awk -Version 0.4.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Lokad.Awk" Version="0.4.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Lokad.Awk" Version="0.4.0" />
                    
Directory.Packages.props
<PackageReference Include="Lokad.Awk" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Lokad.Awk --version 0.4.0
                    
#r "nuget: Lokad.Awk, 0.4.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Lokad.Awk@0.4.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Lokad.Awk&version=0.4.0
                    
Install as a Cake Addin
#tool nuget:?package=Lokad.Awk&version=0.4.0
                    
Install as a Cake Tool

Lokad.Awk

An embeddable awk interpreter for .NET 10. Run ordinary text-processing programs while your application controls files, streams, external commands and resource admission.

dotnet add package Lokad.Awk

Embedding

Supply command-line-style arguments and an IAwkHost implementation. All IO passes through the host; the package does not provide a filesystem or process host.

using Lokad.Awk;

var invocation = AwkCommandInvocation.CreateWithStandardDescriptors(
    "awk",
    ["{ total += $2 } END { print total }", "/data/sales.tsv"],
    [new AwkEnvironmentVariable("PWD", "/")]);

if (!Awk.TryParse(invocation, out var awk))
    throw new InvalidOperationException("Not an awk command.");

IAwkHost host = new ApplicationAwkHost(); // Implement the application's IO boundary.
var policy = AwkExecutionPolicy.CreateRestricted()
    .WithAccessiblePathRoot(new AwkPath("/data"));
using var cancellation = new CancellationTokenSource(TimeSpan.FromSeconds(10));
var exitCode = await awk.ExecuteAsync(host, policy, cancellation.Token);

TryParse recognizes the invocation; execution loads, parses and runs the program. ApplicationAwkHost above is application code; the test suite's MockFileSystem illustrates a host implementation.

Use caller cancellation for deadlines and WithMemoryBudget(IMemoryBudget) for shared memory admission. The restricted preset limits capabilities, stack depth and open resources; aggregate memory admission requires a supplied budget. Text must be valid UTF-8. See the runtime contract for host ownership, cleanup and protection guarantees.

Regex and compatibility

Regex operations require a host-supplied IAwkRegexEngine, configured with policy.WithRegexEngine(engine). Core has no regex backend or Utf8Regex dependency. A copyable adapter uses published Lokad.Utf8Regex 0.4.0 with cooperative cancellation. Its POSIX longest-match and capture-selection gaps remain documented limitations. Non-regex processing needs no provider.

Supported core behavior includes records/fields, expressions, loops, functions, flat arrays, formatting and getline, with selected GNU conveniences. This is not full POSIX/GNU conformance: CSV mode, nested arrays, system() and namespaces remain unsupported.

Before 1.0, minor releases may remove public APIs as described in the release notes.

Building

Use the stable SDK pinned in global.json, then run dotnet test Lokad.Awk.slnx -c Release. CI builds, tests and packs on Windows and Linux. Only src/Lokad.Awk produces a NuGet package; the adapter example, tests and benchmarks are not packaged.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.4.0 94 10/27/2026
0.3.0 99 10/19/2026
0.2.0 196 8/11/2026
0.1.0 176 7/7/2026

See CHANGELOG.md for release details.