#! /usr/bin/awk -f BEGIN { fizz = "Fizz"; buzz = "Buzz"; fizzbuzz = "FizzBuzz" for (i = 1; i <= 30; i++) { fb = (i % 3 ? 0 : 1) + (i % 5 ? 0 : 2) if (fb == 0) print i else if (fb == 1) print fizz else if (fb == 2) print buzz else print fizzbuzz } }