Language
awk
- First appeared
- 1977
- Paradigm
- Data-driven, pattern–action
- Toolchain
- mawk 1.3.4
- Container image
debian:trixie-20261027-slim
awk was written at Bell Labs in 1977 by Alfred Aho, Peter Weinberger, and Brian Kernighan, for processing text files one line at a time. It splits each line into fields for you, so a CSV with no quoted fields is natural input, and every number is a float. That makes it a surprisingly capable data tool, as long as you’re happy to build everything else yourself. These implementations run on mawk, the awk that comes with Debian, and stick to features defined by POSIX.
Quirks
- POSIX awk has no sort function, and mawk has no
asort, so sorting is written by hand. - Arrays are associative, indexed by strings, and an unset variable is both
0and the empty string. 7 / 2is3.5: there is no integer division.
Concepts in awk
- Cross-validation
- Decision tree
- Descriptive statistics
- k-means clustering
- k-nearest neighbors
- Linear regression
- Logistic regression
- Naive Bayes
- Principal component analysis
Run the examples locally
You need Docker and Python 3. The harness builds the pinned container and runs every awk example:
git clone https://github.com/qnixon/dswithx.git
cd dswithx
python3 harness/run_tests.py --language awk