unix - Bourne shell script to convert a number to telephone format -


I want to change a number such as 1234567890 to 456-7890; Is there any way to do this in Unix shell programming?

This is what DigitalRoss and Jonathan Lefler Were trying to say:

  echo "1234567890" | Sed 's / [0-9] [0-9] [0-9] \ ([0-9] [0-9] [0-9] \) \ ([0-9] [0-9] [0-9] [0-9] \) / \ 1- \ 2 / ' 

It should work at all, but most of the brains of sed -Mult editions, though it does not take into account the limitations of the word, or are there an additional number or group of digits on the same line. It only improves the first ten digit sequence that it finds if you have spaces, tabs, commas or other delimiters, then they can be used to restrict the match.


Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -