Removing all characters except digits from clipboard I'm trying to refine a script I use within an Automator program and I would appreciate your help on this.

The program is designed to mark a telephone number into clipboard make a tel:link and send it to an telephone application, which works fine.
I only have a problem if the marked phonenumber looks something like this: +49(1)123/12345 because then I have to remove all the special characters and leave only the digits and the + in front of the number.

The problem is I'm not that good at scripting, so how to do it?
The shell snippet

pbpaste | tr -cd "[:digit:]+" | pbcopy


will take the content of the clipboard, remove all non-digits and put the result back into the clipboard.