#! /usr/bin/gawk -f # Last edited on 2014-06-10 00:05:10 by stolfilocal BEGIN { # Converts encoded DNA sequence files (".eqs") from the 2008-01-29 format to the 2013-10-23 format. # User may define (with "-v") the {id} and {name} fields. if (id == "") { id = 0; }; if (name == "") { name = ("a" (id == 0 ? "" : sprintf("%05d", id))); } } /^(begin|end) encoded_bio_seq/ { gsub(/2008-01-29/, "2013-10-23", $0); print; next; } /^[|]/ { print; next; } /^level[ ]+[=][ ]+/ { level = $3; printf "id = %d\n", id; printf "name = %s\n", name; printf "reversed = F\n"; printf "resampling = %d\n", level; printf "offset = 0\n"; next; } /^circular[ ]+[=][ ]+/ { next; } /^(channels|scale)[ ]+[=][ ]+/ { print; next; } /^samples[ ]+[=][ ]+/ { gsub(/samples/, "datums", $0); print; next; } /^[ ]*[-+]?[0-9]/ { print; next; } // { printf "%s:%s: ** invalid format\n", FILENAME, FNR > "/dev/stderr"; printf " [%s]\n", $0; exit(1); }