DEV Community

Miss Pooja Anilkumar Patel
Miss Pooja Anilkumar Patel

Posted on • Updated on

193. leetcode Solution in Bash

while read line; do
    if [[ "$line" =~ ^((\([0-9]{3}\) )|[0-9]{3}-)[0-9]{3}-[0-9]{4}$ ]]; then
        echo $line
    fi
done < "file.txt"
Enter fullscreen mode Exit fullscreen mode

Top comments (0)