I am trying to write a script that uses sed and takes takes a text file containing phone numbers with area code 301 followed by 209( 3012093934, (301) 2093935, (301)209-3936 ). I have to remove the blank, dash, parenthesis where they separate the area code and the number. Then I have to write the correct numbers to another file; the correct numbers meaning the ones that start by area code 301, followed by 209 and exactly 4 more digits.
So my regular expression is this but doesn't seem to work correctly:
sed -n 's/(^301[\- ]*)/(209)/([0-9][0-9][0-9][0-9]$\)/p'
Can somebody help? Thanks in advance!!!