#! /usr/bin/gawk -f # Usage: "$0 < joinfile > output.cmp # This script is used internally by compare-probs. # The input should be a file in the format "word fr1 fr2 ... frn" # where the "fr"s are freqs in [0_1]. # Outputs a fixed format listing " fr1 fr2 ... frn word" # using 7 columns per "fr" field. # If a '#' comment with N other tokens is given, prints # dashes for N columns. # WARNING: the word should not contain any spaces. /^#/ { for (i=2;i<=NF;i++) printf " %-7.7s", "--------------------------"; printf " %s", "---------"; printf "\n"; next; } /./ { for (i=2; i<=NF; i++) { v = $(i); printf " %7s", ( v == 0 ? "." : v ) ; } printf " %s\n", $1; next; }