Following scripts offer you that finding Hangul, Katakana, Hiragana, Ganji(Han), Hiragana in your source code (ts file)
"^((?!\/\/).)*"means that ignore "// comments".
The script uses "property-name" of Regular Expressions.
#!/bin/bash
BASE_SRC_FOLDER=../src
IGNORE_FILE_POSTFIX=( "spec.ts" )
#GREP_PATTERN="^((?!\/\/).)*(\p{Hiragana}|\p{Han}|\p{Katakana})" # for Japanse
GREP_PATTERN="^((?!\/\/).)*\p{Hangul}.*" # for Hangul
CUR_DIR=`pwd`
if [ "`basename $CUR_DIR`" != "script" ]; then
echo "Error: you must run `basename $0` in script directory."
exit
fi
echo "Search predefined characters in ts file of ${BASE_SRC_FOLDER} folder."
TS_FILE_LIST=`find ${BASE_SRC_FOLDER} -name "*.ts"`
for CUR_FILE in $TS_FILE_LIST
do
let IS_RUN=1
for CUR_IGNORE_FILENAME in ${IGNORE_FILE_POSTFIX[@]}
do
if [ "${CUR_FILE%${CUR_IGNORE_FILENAME}}" != ${CUR_FILE} ] ; then
let IS_RUN=0
break
fi
done
if [ $IS_RUN -eq 1 ]; then
grep -nHP "${GREP_PATTERN}" ${CUR_FILE}
fi
done
"^((?!\/\/).)*"means that ignore "// comments".
The script uses "property-name" of Regular Expressions.
#!/bin/bash
BASE_SRC_FOLDER=../src
IGNORE_FILE_POSTFIX=( "spec.ts" )
#GREP_PATTERN="^((?!\/\/).)*(\p{Hiragana}|\p{Han}|\p{Katakana})" # for Japanse
GREP_PATTERN="^((?!\/\/).)*\p{Hangul}.*" # for Hangul
CUR_DIR=`pwd`
if [ "`basename $CUR_DIR`" != "script" ]; then
echo "Error: you must run `basename $0` in script directory."
exit
fi
echo "Search predefined characters in ts file of ${BASE_SRC_FOLDER} folder."
TS_FILE_LIST=`find ${BASE_SRC_FOLDER} -name "*.ts"`
for CUR_FILE in $TS_FILE_LIST
do
let IS_RUN=1
for CUR_IGNORE_FILENAME in ${IGNORE_FILE_POSTFIX[@]}
do
if [ "${CUR_FILE%${CUR_IGNORE_FILENAME}}" != ${CUR_FILE} ] ; then
let IS_RUN=0
break
fi
done
if [ $IS_RUN -eq 1 ]; then
grep -nHP "${GREP_PATTERN}" ${CUR_FILE}
fi
done
Comments
Post a Comment