Skip to content

Commit f4b4beb

Browse files
committed
stat the valid mobile
1 parent 0d81d5b commit f4b4beb

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

bash/mobile_validation.sh

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
#!/bin/bash
22

3+
#
4+
# Usage:
5+
# $ ./mobile_validation.sh mobile.txt
6+
#
7+
8+
Usage="Usage: $0 mobile_file"
9+
if [ $# -ne 1 ]; then
10+
echo ${Usage}
11+
exit 1
12+
fi
13+
14+
# input file
315
filename=$1
4-
grep "^0\?\(13[0-9]\|15[012356789]\|17[0678]\|18[0-9]\|14[57]\)[0-9]\{8\}" $filename
16+
total_count=`wc -l $filename | cut -d' ' -f1`
17+
valid_count=`grep "^0\?\(13[0-9]\|15[012356789]\|17[0678]\|18[0-9]\|14[57]\)[0-9]\{8\}" $filename | wc -l`
18+
echo "valid mobile: ${valid_count}"
19+
echo "toatl mobile: ${total_count}"

0 commit comments

Comments
 (0)