Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

with the following command I can verify/match if param have numbers or "."

  echo $param |  grep [0-9][.] 

but what I need to add in my syntax in order to verify also if I have at least two numbers (number or more on the right side and number or more on the left side)

example of valid numbers


example of not valid numbers

share|improve this question
A regex for version number parsing – slhck Feb 15 '12 at 15:34
this perl example I need ksh /shellscript example – Eytan Feb 15 '12 at 15:49
Fair enough, but you didn't say that anywhere, plus, which Linux doesn't have perl? – slhck Feb 15 '12 at 15:53

This works in bash(I don't have ksh):

grep '^\([0-9]\+\.\)\+[0-9]\+$'
share|improve this answer
this example not work? echo | grep '^([0-9]\+\.)\+[0-9]\+$' – Eytan Feb 15 '12 at 16:12
@Eytan: echo | grep '^\([0-9]\+\.\)\+[0-9]\+$' works. Why do you use underscore(_)? – kev Feb 15 '12 at 16:17
because the numbers can be with any char as "_" – Eytan Feb 15 '12 at 22:26
@Eytan change [0-9] to [0-9_] – kev Feb 16 '12 at 0:43
this syntax not work on solaris – Eytan Feb 16 '12 at 11:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.