Removing all characters except digits from clipboard
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.