wade/liu: liu.sh

File liu.sh, 689 bytes (added by wade, 16 years ago)
Line 
1#!/bin/bash
2
3if [ "$1" == "" ]; then
4  echo
5  echo Usage:
6  echo "      " "$0" \[filename\]
7  echo
8  echo Example:
9  echo "        " "$0" LIU5.CIN
10  echo
11  exit
12fi
13
14if [ ! -f "$1" ]; then
15  echo "$0": No such file
16  exit
17fi
18
19echo
20echo Generating noseeing.gtab ...
21
22iconv -f CP950 -t UTF-8 -c "$1" | \
23sed -e 's/^%prompt 無蝦米/%prompt 嘸蝦米/' \
24    -e 's/^%dupsel 9/%space_style 1/' \
25    -e 's/^\] 〔/\] 〕/' | \
26grep -v '^%quick ' | \
27grep -v '^%sel1st ' > noseeing.cin
28rm -fr noseeing.gtab
29gcin2tab noseeing.cin > /dev/null 2>&1
30
31if [ -f noseeing.gtab ]; then
32  echo
33  echo Done.
34  echo
35  echo Please copy noseeing.gtab to $HOME/.gcin or /usr/share/gcin/table
36  echo
37  exit
38fi