#!/bin/awk BEGIN { if (color) { HEAD = " \033[33m\033[1m%s\033[0m\n" TRAN = " \033[32m%s\033[0m\n" } else { HEAD = " %s\n" TRAN = " %s\n" } stop = 0 } !stop { if (match($0, //, m)) { sentence = m[1] } else if (match($0, /(\w)/, m)) { pronounce = m[1] } else if (match($0, /(.+)<\/span>/, m)) { phonetic = m[1] } else if (match($0, /
  • ([a-z]+\..+)<\/li>/, m)) { if (sentence) { printf HEAD, sentence sentence = "" } printf TRAN, m[1] } else if (match($0, /
    (.+)<\/a>/, m)) { printf " %s\n", m[1] } else if (synonyms && match($0, /<\/div>/)) { stop = 1 } if (pronounce && phonetic) { printf " %s %s %s\n", PI, pronounce, phonetic pronounce = "" phonetic = "" } }