?? look1
字號:
#!/bin/ksh#@(#) 查詢字典中的字段含義、if [[ $# != 2 ]] then echo 用法: look1 中文或英文 交易終端類型 如 TT,ST exit 1finame=$1if [[ `expr "$1" : '[a-zA-Z0-9_.]*' ` = ${#1} ]] then name=`echo $1 | tr "[:upper:]" "[:lower:]"`fidigit=0if [[ `expr "$1" : "[[:digit:]]*" ` = ${#1} ]] then digit=1fitype=$2type=`echo $type | tr "[:lower:]" "[:upper:]"`[[ $type = TT ]] && DictFile=$HOME/dict/dict.dat [[ $type = TT ]] || DictFile=$HOME/dict/dict.dat [[ $type = ST ]] && DictFile=$HOME/dict/dict.handsome [[ $type = SE ]] && DictFile=$HOME/dict/dict.handsome[[ $type = IB ]] && DictFile=$HOME/dict/dict.ibs[[ $type = AG ]] && DictFile=$HOME/dict/dict.dat[[ $type = EX ]] && DictFile=$HOME/dict/dict.dat[[ $type = KN ]] && DictFile=$HOME/dict/dict.kernel[[ $type = UM ]] && DictFile=$HOME/dict/dict.fund[[ $type = CM ]] && DictFile=$HOME/dict/dict.cmif [[ $digit = 0 ]] then nawk ' BEGIN { label=0; } $1!~/^#/ { $2 = tolower( $2 ); } $1~/'"$name"'/ || $2~/'"$name"'/ { label = 1; printf("%30s %12s %20s %s\n", $1, $2,$3,$4) ; while( 1 ){ if( getline == 0 ) break; if( $1~/^#/ || length( $0 ) == 0 ) print $0; else { $2 = tolower( $2 ); if( index( $1, "'"$name"'" ) || index( $2, "'"$name"'" ) ){ printf("%30s %12s %20s %s\n", $1, $2,$3,$4) ; continue; } break; } } } END { if( label == 0 ) print "'"$1"' 不在數據字典中 " } ' $DictFileelse nawk ' BEGIN { label=0; nubr=0; } $1~/^#/ || length( $0 ) == 0 { continue; } { nubr++; $2 = tolower( $2 ); if( nubr == '"$1"' ){ printf("%-8s %-12s %-30s \n","'"$1"'", $2, $1) ; label = 1; } if( label == 1 ) exit( 1 ); } END { if( label == 0 ) print "'"$1"' 不在數據字典中 " } ' $DictFilefi
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -