#!/usr/bin/env -S awk -f function cycle (c, x) { printf x - 2 < c && c < x + 2 ? "#" : "." printf c == 39 ? "\n" : "" return (c + 1) % 40 } BEGIN { x = 1 } { c = cycle(c, x) } /^addx/ { c = cycle(c, x) } { x += $2 }