Skip to content

Commit 356e574

Browse files
authored
Create 193-valid-phone-numbers.sh
1 parent 26c1980 commit 356e574

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

193-valid-phone-numbers.sh

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Read from the file file.txt and output all valid phone numbers to stdout.
2+
awk '/^([0-9]{3}-|\([0-9]{3}\) )[0-9]{3}-[0-9]{4}$/' file.txt
3+
4+
# another
5+
6+
grep -P '^(\(\d{3}\) |\d{3}-)\d{3}-\d{4}$' file.txt
7+
8+
# another
9+
10+
sed -n -r '/^([0-9]{3}-|\([0-9]{3}\) )[0-9]{3}-[0-9]{4}$/p' file.txt

0 commit comments

Comments
 (0)