Created
February 19, 2011 05:47
-
-
Save masonicboom/834859 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # This script prints each word in $dict_file, one per line. | |
| # $dict_file is a file from http://www.csse.monash.edu.au/~jwb/edict_doc.html. | |
| # See http://www.csse.monash.edu.au/~jwb/jmdict_dtd_h.html to understand why | |
| # <keb> and </keb> are used. | |
| start_marker="<keb>" | |
| end_marker="</keb>" | |
| dict_file=JMdict_e | |
| # This grep-based method will break if any of the "keb" elements in $dict_file | |
| # spans multiple lines. | |
| for line in $(grep $start_marker $dict_file); do | |
| word=${line#$start_marker} | |
| word=${word%$end_marker} | |
| echo $word | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment