#! /usr/bin/gawk -f # Last edited on 2001-11-17 16:41:24 by stolfi # Formats a candidate list, aligning fields in columns. # If the matched length is 0, recomputes it. /^ *[0-9]/ { if (NF < 13) { printf "line %d: bad format\n", FNR > "/dev/stderr"; exit 1; } if ($12 + 0 == 0) { $12 = ($4 + $9)/2; } printf "%03d %04d %4d %3d %s %03d %04d %4d %3d %s %s %6.1f %s", $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13; for (i=14; i<=NF; i++) { printf " %s", $(i); } printf "\n"; next; } /./ { print; next; }