Note:
- Bash 3.00
How to substitute this example string 123456789, to look like 123-456-789
#!/bin/sh
# trivial example
read number;
# monotically substitute '-' into string after first three and dix digits
phone=`echo $phone | sed 's/\(...\)\(...\)/\1-\2-/'`
man bash and search for backquote for more info on this).$() is preferred over backquotes and works in Bash, zsh, ksh and dash (sh), but may not in the Bourne shell and doesn't in the C shell. It is specified by POSIX. opengroup.org/onlinepubs/009695399/utilities/…