# A script to format Kanji data as "flash cards" for # learning. This script was written for mawk BEGIN {RS="#";FS="\n"} BEGIN { print "\ \n\ \n\ \n\ Kanji Flash Cards \n\ \n\ \n\ \n\ " ii=1 } { record["#"] = $1 split($2, fields, " *") record[fields[1]] = fields[2] for(i = 3 ; i <= NF ; i++) { split($i, fields, ": *") record[fields[1]] = record[fields[1]] fields[2] # print fields[1] ";; " record[fields[1]] } delete record[""] for (j in record) { # print j "|" record[j] } if (record["=="] ~ /^ *$/) delete record print " " if (ii % 2 == 0) print "" if (ii % 2 == 1) print "" ii++ delete record } END { print "\
" if (ii % 2 == 1) print "
" print "\n" print "" print "" print "
"; print "
" record["=="] "
" print "

"; print "
    "; print "
  • " record["Kana"] "
  • " print "
  • " record["Romaji"] "
  • " print "
  • " record["Meaning"] "
  • " print "
" print "
" print "" print "
" record["#"] " | " record["Radical"] " |" print "Grade: " record["Grade"] " |" print record["Usage"] " | U: " record["Unicode"] print "
" if (ii % 2 == 0) print "
\n\ \n\ \n\ " }