DDSA
Advertisement

193. Valid Phone Numbers

193.sh
Shell
# Read from the file file.txt and output all valid phone numbers to stdout.
grep -e "^[0-9]\{3\}\-[0-9]\{3\}\-[0-9]\{4\}$" -e "^([0-9]\{3\}) [0-9]\{3\}\-[0-9]\{4\}$" file.txt
Advertisement
Was this solution helpful?