#!/usr/bin/awk -f { gsub(/\^/, "|") } /^1/ { print >> "header.txt" } /^[234]/ { print >> "data.txt" } /^8/ { print >> "questions.txt" }