KSH - Character Replacement

Hey all.

Easy question.

I have a (ksh) varaible x. It contains the following (for example): N557788

I want to replace the "N" with a "-".

I've done this before but for the life of me I cannot remember how I did it.

Thanks.

mtw

I had an epiphany! (actually I just remembered what I had done earlier)

This is what I was looking for; nice and simple:

x=`print $4 | sed 's/N/-/'`

With $4 being passed in from another script which is N557788...

Thanks.

You can do it all in shell
(without calling external utilities, like sed for example), but it depends on your ksh version.
Is N in fixed or variable position?
One or many occurrences?

With ksh93(dtksh on Solaris):

$ print ${.sh.version}
Version M 1993-12-28 r
$ v="N557788"
$  print -- ${v/N/-}
-557788

For older versions of ksh the solution depends on the answers of the above questions.