linux + sed - replace only the right most side char of string

You can use the end-of-pattern-space pattern. The pattern $ matches the null string at the end of the pattern space. With this pattern you can avoid using rev as advised above.

  $ echo machine1a | sed 's/a$/b/'
  machine1b

% echo machine1a | rev | sed s'/a/b/' | rev
machine1b

I can't find a way to do this with sed alone. There is a flag to the s operation specifies to only replace the Nth match, but counting from the end doesn't work.

% echo machine1a | sed s'/a/b/2'
machine1b