awk Playground

A live AWK REPL that runs entirely in your browser β€” a pure-JavaScript interpreter (verified against real gawk), companion to the sed playground. Write a program, feed it input, and watch stdout update as you type.

⌘/Ctrl+↡ run Β· ⌘/Ctrl+K clear

  
Supported features & syntax

This playground implements a faithful subset of POSIX awk in pure JavaScript β€” no server, no WASM β€” verified against real gawk. EREs are translated to JavaScript regex. There is no filesystem, so getline, print > file, | cmd, and system() degrade gracefully (redirections write to stdout with a note).

rulespattern { action }, bare pattern (prints $0), bare { action }, BEGIN {}, END {}, and /re/,/re/ ranges.
fields$0 $1 … $NF, $(expr), assigning fields (rebuilds $0 with OFS), assigning $0 re-splits.
varsNR NF FNR FS OFS ORS RS SUBSEP CONVFMT OFMT RSTART RLENGTH; -F and -v.
operatorsarithmetic + - * / % ^, ++ --, comparisons, && || !, ternary ?:, concat, ~ !~, in, assignment ops.
controlif/else, while, do/while, for(;;), for(k in a), break continue next exit return delete.
arraysassociative a[k], multi-subscript a[i,j], k in a, delete, user functions.
builtinslength substr index split sub gsub match sprintf, sin cos atan2 exp log sqrt int rand srand, tolower toupper, and printf.

Everything runs locally; nothing is uploaded.