#!/usr/bin/awk -f # Downloadable example 7 for GNU Awk Part 15 BEGIN { db = "awktest.db" cmd = "sqlite3 " db querytpl = "select id,title from episodes where id = %d;\n" } $0 ~ /^[0-9]+$/ { printf querytpl,$0 |& cmd cmd |& getline result print result }