#!/bin/sed -rf # # Using kanji data from tangorin.com to create printable flash # cards in an HTML format # 1i\ \ \ \ Kanji Flash Cards \ \ \ \ 1 {x; s/^/<1>/; x;} /^ *#/ { x; /<1>/{ s/.*/<1>/;l; } /<2>/{ s/.*/<2>/;l; } x; s|^ *#|\n
\n\n\n| H; d; } /^ *Kana:/ { s|^ *Kana: *|
  • | s| *$|
  • | } /^ *Romaji:/ { s|^ *Romaji: *|
  • | s| *$|
  • \n| } /^ *Meaning:/ { s|^ *Meaning: *|
  • | s| *$|
  • \n \n\n| G; x; #/<1>/{ s/[\n.]*/<2>/g } #/<2>/{ s/[\n.]*/<1>/g } #s/.*// x; } /^ *Strokes:/ { #s|^ *Strokes: *|\n\n
    | s| *$|| x; #/<1>/{ s/^[\n.]*/<2>/;l; } #/<2>/{ s/^[\n.]*/<1>/;l; } x; } /^ *==/ { s|^ *== *|
    |; s|$|
    \n
    \n
      |; } /^ *Utf8:/ { s|^ *Utf8: *|
    | #s| *$| \|| s/.*// } /^ *Radical:/ { s|^ *Radical: *|\n
    | s| *$| \|| } /^ *Pinyin:/ { #s|^ *Pinyin: *|| #s| *$| \|| s/.*// } /^ *Grade:/ { s| *$| \|| } /^ *Usage:/ { s|^ *Usage: *|| s| *$| \|| } /^ *Unicode:/ { s|^ *Unicode: *| U:| } /^ *JLPT:/ { d; } # s|$|
    |;
    $a\
     \
     \