📄 chkdict
字号:
#!/bin/kshDictDir=$HOME/hpux/dictDictFile=dict.dat[[ ${#1} > 0 ]] && DictFile=$1rm -f ${DictDir}/dict.tmpawk ' length($0) > 0 && $1!~/^#/ { print $1, tolower($2),tolower($3);}' ${DictDir}/${DictFile} > ${DictDir}/dict.tmpfor i in 1 2 3do if [[ $i = 1 ]] then echo " 检查中文名称" comment=" 检查中文名称" elif [[ $i = 2 ]] then echo " 检查英文名称" comment=" 检查英文名称" else echo " 检查数据类型" comment=" 检查数据类型" fi awk -v cout=$i ' BEGIN { nubr=0; } { print $'"$i"'; if ( cout == 3 ){ type = $'"$i"'; if( type != "char" && type != "smallint" && type != "int" && type != "dec" && type != "date" ){ nubr++; print $0 " 数据类型 " $3 " 不合法,应为 int smallint dec date char 之一" > "/dev/stderr"; } } } END { if ( cout == 3 && nubr == 0 ){ print " 所有字段数据类型都合法" > "/dev/stderr"; } }' ${DictDir}/dict.tmp > ${DictDir}/a if [[ $i = "3" ]] then break fi sort ${DictDir}/a >${DictDir}/b uniq -c ${DictDir}/b >${DictDir}/c awk ' BEGIN { cout=0; label=0; } $1 > 1 { print; cout++; } END { if( cout == 0 ){ print "'"$comment"',无重复值"; } } ' ${DictDir}/cdonerm -f ${DictDir}/a ${DictDir}/b ${DictDir}/c
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -