removing special characters, white spaces from a field in a file

what my code is doing, it is executing a sql file and the resullset of the query is getting stored in the text file in a fixed format. for that fixed format i have used the following code::

Code:

awk -F":" '{printf("%-20.20s:%-20.20s:%-20.20s:%-20.20s:%-15.15s:%-3.3s:%-19.19s:%-2.2s:%-20.20s:%-15.15s:%-2.2s\n", $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)}' $DIALPBIN/temp1.txt > ${DIALPBIN}/temp2.tx

now 5th filed is a phone number. in the database it contains brackets like (0124)-23456
but in the file the output should be like 012423456

Could you please help????

looks suspiciously like homework...

however, look into using sed.

To keep the forums high quality for all users, please take the time to format your posts correctly.

First of all, use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags

```text
 and 
```

by hand.)

Second, avoid adding color or different fonts and font size to your posts. Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red.

Third, be careful when you cut-and-paste, edit any odd characters and make sure all links are working property.

Thank You.

The UNIX and Linux Forums

+++++++++++++++++++++++++++++++++++++++++++++++++++++

Remove those characters before the printf statement with:

gsub("[()-]","",$5)

Regards