to find the number from a line.

Hi,
I need to write a script which will have a text string as a input and the output should find out the number in the text string and add one to it.

Eg:
Input => asfdosainovih1234lnsiohn
Output => 1235

All the numbers in the text will be together and only one time in the line.

Thanks,
vikings.

#!/bin/ksh
typeset -i value
echo asfdosainovih1234lnsiohn | tr -dc '[:digit:]' | read value
value=$(( $value + 1 ))
echo $value

This sounds like homework.

Thanks a lot... I didnt know about the tr command. can you please explain how this works with the parameter -dc.

I can assure you that this is not homework. I am too old to go to school now :slight_smile: