Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to convert Ph # format from (xxx)-xxx-xxxx to xxxxxxxxxx 1

Status
Not open for further replies.

udaybo

Programmer
Jun 2, 2008
23
US
Hello all

I am new to scripting, I am workng on a text file where I have a field for phone numbers, but these phone numbers are in different format.

Can we convert ph# format(xxx)-xxx-xxxx to xxxxxxxxxx.

Can anyone please help me with this.

Thanks a Lot
 
If the "convert format" implies to just remove the ( ) and - from the original text,
then I belive the Stream EDitor SED is the solution.
Something like this:
Code:
echo "ph# format(xxx)-xxx-xxxx" | sed 's/[()-]//g'

HTH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top