Understandable solution


#1

cat input | grep -P “^\d{3}-\d{3}-\d{4}$|^(\d{3}) \d{3}-\d{4}$”